Skip to content

Fix used after free issue in SerialIOTests #1657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4286,11 +4286,11 @@ void adios2_bp5_flush(std::string const &cfg, FlushDuringStep flushDuringStep)
REQUIRE(currentSize <= 4096);
}

bool has_been_deleted = false;
auto has_been_deleted = std::make_shared<bool>(false);
UniquePtrWithLambda<int32_t> copied_as_unique(
new int[size], [&has_been_deleted](int const *ptr) {
new int[size], [has_been_deleted](int const *ptr) {
delete[] ptr;
has_been_deleted = true;
*has_been_deleted = true;
});
std::copy_n(data.data(), size, copied_as_unique.get());
{
Expand All @@ -4308,13 +4308,13 @@ void adios2_bp5_flush(std::string const &cfg, FlushDuringStep flushDuringStep)
{
// should now be roughly within 1% of 16Mb
REQUIRE(std::abs(1 - double(currentSize) / (16 * size)) <= 0.01);
REQUIRE(has_been_deleted);
REQUIRE(*has_been_deleted);
}
else
{
// should be roughly zero
REQUIRE(currentSize <= 4096);
REQUIRE(!has_been_deleted);
REQUIRE(!*has_been_deleted);
}
}
auto currentSize = getsize();
Expand Down
Loading