HomePhabricator

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

Description

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

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>

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8958

Details

Provenance
practicalswift <practicalswift@users.noreply.github.com>Authored on Jan 13 2020, 15:08
FabienCommitted on Jan 19 2021, 16:33
FabienPushed on Jan 19 2021, 16:35
Reviewer
Restricted Project
Differential Revision
D8958: tests: Add amount compression/decompression fuzzing to existing fuzzing harness
Parents
rABC69aed0c33172: tests: Avoid hitting some known minor tinyformat issues when fuzzing strprintf(.
Branches
Unknown
Tags
Unknown