diff options
author | Dima Panov <fluffy@FreeBSD.org> | 2022-05-23 19:38:17 +0000 |
---|---|---|
committer | Dima Panov <fluffy@FreeBSD.org> | 2022-05-23 19:40:36 +0000 |
commit | 2d88b73b83e0d1220373939528c3316b2ceb88fb (patch) | |
tree | 0773a0e1fc1fa69ace5100afbc245ec92362bb2c | |
parent | c782899226218ee9955cc1a9c6881dfaba96a560 (diff) |
devel/boost-libs: add critical upstream patch (+)
Boost.JSON array::erase can segfault, see https://github.com/boostorg/json/issues/692
-rw-r--r-- | devel/boost-libs/Makefile | 1 | ||||
-rw-r--r-- | devel/boost-libs/files/patch-0001-json-array-erase-relocate | 49 |
2 files changed, 50 insertions, 0 deletions
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(); + } + }; + |