Page MenuHomePhabricator

fix out-of-bounds memory write in key_tests
ClosedPublic

Authored by markblundeberg on May 4 2019, 16:48.

Details

Summary

Introduced by me in D2348. Thanks to Jason for catching this with ASan.

Test Plan

make check

I ran ASan-compiled ./src/test/test_bitcoin --run_test=key_tests with and without this patch. Prior to patch it revealed memory error "WRITE of size 32"; afterwards it has no errors.

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

markblundeberg created this revision.May 4 2019, 16:48
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 4 2019, 16:48
markblundeberg edited the test plan for this revision. (Show Details)May 4 2019, 17:24
markblundeberg edited the test plan for this revision. (Show Details)

Bug was that even when rlen < 32, it always tries to write 32 bytes into ret, but offset such that it would write past the end of ret.

markblundeberg edited the test plan for this revision. (Show Details)May 4 2019, 18:02
deadalnix accepted this revision.May 4 2019, 18:26
This revision is now accepted and ready to land.May 4 2019, 18:26
This revision was automatically updated to reflect the committed changes.