packages/libs/boost/patches/910-json-array-erase-relocate.patch
Carlos Miguel Ferreira d4db474c81 boost: Updates package to version 1.79.0
This commit updates boost to version 1.79.0

There are no new libraries in this version

The following patches were removed due to upstream update:
* 010-fix-b2-install.patch [1]
* 020-fix-musl-build.patch [2]

More info about Boost 1.79.0 can be found at the usual place [3].

Note: This package update includes a fix merged to Boost.JSON in [4]
which did not make into this version.

[1]: 78fd284a42
[2]: https://github.com/boostorg/interprocess/pull/162
[3]: https://www.boost.org/users/history/version_1_79_0.html
[4]: https://github.com/boostorg/json/issues/692

Signed-off-by: Carlos Miguel Ferreira <carlosmf.pt@gmail.com>
2022-04-30 23:58:02 -07:00

47 lines
923 B
Diff

--- a/boost/json/impl/array.ipp
+++ b/boost/json/impl/array.ipp
@@ -491,8 +491,11 @@ erase(
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;
}
--- a/libs/json/test/array.cpp
+++ b/libs/json/test/array.cpp
@@ -1270,6 +1270,21 @@ public:
}
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 @@ public:
testExceptions();
testEquality();
testHash();
+ testIssue692();
}
};