Page MenuHomePhabricator

Fix heap-use-after-free in activation_tests
ClosedPublic

Authored by jasonbcox on Dec 21 2019, 02:09.

Details

Summary

CreateChainParams() returns a unique_ptr that ends up with no owner. This patch fixes that.

Test Plan
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=address -DCCACHE=OFF ..
ninja test_bitcoin
./src/test/test_bitcoin --run_test=activation_tests

Before patch: Same failure as seen here: https://build.bitcoinabc.org/viewLog.html?buildId=24568&buildTypeId=BitcoinABC_Master_BitcoinAbcMasterAsan&tab=buildLog&_focus=1047
After patch: No errors detected

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix requested changes to this revision.Dec 21 2019, 02:26

Just hold onto the unique_ptr . The Params struct is huge and clearly not meant to be used by value.

This revision now requires changes to proceed.Dec 21 2019, 02:26
This revision is now accepted and ready to land.Dec 22 2019, 03:22
src/test/activation_tests.cpp
28 ↗(On Diff #15064)

Note that this doesn't follow the convention that is used all over the codebase.

Fabien added a subscriber: Fabien.

Oups, I missed the issue, thank you for handling this !