git: 2d88b73b83e0 - main - devel/boost-libs: add critical upstream patch (+)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 May 2022 19:40:45 UTC
The branch main has been updated by fluffy: URL: https://cgit.FreeBSD.org/ports/commit/?id=2d88b73b83e0d1220373939528c3316b2ceb88fb commit 2d88b73b83e0d1220373939528c3316b2ceb88fb Author: Dima Panov <fluffy@FreeBSD.org> AuthorDate: 2022-05-23 19:38:17 +0000 Commit: Dima Panov <fluffy@FreeBSD.org> CommitDate: 2022-05-23 19:40:36 +0000 devel/boost-libs: add critical upstream patch (+) Boost.JSON array::erase can segfault, see https://github.com/boostorg/json/issues/692 --- devel/boost-libs/Makefile | 1 + .../files/patch-0001-json-array-erase-relocate | 49 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/devel/boost-libs/Makefile b/devel/boost-libs/Makefile index 3613bd48c87f..7fb071997e2f 100644 --- a/devel/boost-libs/Makefile +++ b/devel/boost-libs/Makefile @@ -1,6 +1,7 @@ # Created by: Alexander Churanov <churanov.port.maintainer@gmail.com> PORTNAME= boost-libs +PORTREVISION= 1 COMMENT= Free portable C++ libraries (without Boost.Python) diff --git a/devel/boost-libs/files/patch-0001-json-array-erase-relocate b/devel/boost-libs/files/patch-0001-json-array-erase-relocate new file mode 100644 index 000000000000..d322b64f4477 --- /dev/null +++ b/devel/boost-libs/files/patch-0001-json-array-erase-relocate @@ -0,0 +1,49 @@ +diff -ur boost/json/impl/array.ipp boost/json/impl/array.ipp +--- boost/json/impl/array.ipp 2022-04-06 17:02:43.000000000 -0400 ++++ boost/json/impl/array.ipp 2022-04-13 20:55:20.464359478 -0400 +@@ -491,8 +491,11 @@ + auto const p = &(*t_)[0] + + (pos - &(*t_)[0]); + destroy(p, p + 1); +- relocate(p, p + 1, 1); + --t_->size; ++ if(t_->size > 0) ++ relocate(p, p + 1, ++ t_->size - (p - ++ &(*t_)[0])); + return p; + } + +diff -ur libs/json/test/array.cpp libs/json/test/array.cpp +--- libs/json/test/array.cpp 2022-04-06 17:02:43.000000000 -0400 ++++ libs/json/test/array.cpp 2022-04-13 20:53:32.671782680 -0400 +@@ -1270,6 +1270,21 @@ + } + + void ++ testIssue692() ++ { ++ array a; ++ object obj; ++ obj["test1"] = "hello"; ++ a.push_back(obj); ++ a.push_back(obj); ++ a.push_back(obj); ++ a.push_back(obj); ++ a.push_back(obj); ++ while(a.size()) ++ a.erase(a.begin()); ++ } ++ ++ void + run() + { + testDestroy(); +@@ -1283,6 +1298,7 @@ + testExceptions(); + testEquality(); + testHash(); ++ testIssue692(); + } + }; +