Page MenuHomePhabricator

tests: Add amount compression/decompression fuzzing to existing fuzzing harness
ClosedPublic

Authored by Fabien on Jan 19 2021, 13:21.

Details

Summary
Small fuzzing improvement:

Add amount compression/decompression fuzzing to existing fuzzing
harness: test compression round-trip
(DecompressAmount(CompressAmount(…))).

Make the domain of CompressAmount(…) explicit.

Backport of core PR17917.

This is actually adapted to fix an existing fuzzing issue: the
CompressAmount() function expects the amount to be positive, while our
Amount operator works on signed integer. As a consequence the case
where the amount is negative is skipped to match the CompressAmount()
precondition.

Test Plan
ninja bitcoin-fuzzers
./src/test/fuzz/integer <path_to_corpus>