You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-10-23 21:28:56 +03:00
Add libFuzzer targets for the JSON, ini, and pack readers in test/fuzz. Each target runs an input through the reader and discards the errors thrown for invalid input, while a failed assertion or a sanitizer report aborts. The targets are linked with the objects of the pgbackrest binary when the fuzz-engine meson option is set. test/fuzz/build.sh builds the targets and seed corpora in the environment that OSS-Fuzz defines, so an OSS-Fuzz project can call it if pgBackRest is accepted. Until then the fuzz workflow builds the targets with clang, AddressSanitizer, and UndefinedBehaviorSanitizer and runs each one for a fixed number of runs. The seed is derived from the commit hash and ASLR and corpus reloading are disabled, so a failed run can be reproduced. Fuzzing found or led to the bugs fixed in these commits:81704daafCheck the mem context stack bounds in production builds.4b8e3f438Limit the depth of nested containers when reading JSON.b623071a2Fix reads past the end of JSON strings ending in an escape.2b919843aReject unexpected commas when reading JSON.1808295ccReject \u0000 when reading JSON strings.b63357ee8Accept hex digits in JSON \u escapes when skipping.6963016c7Error on invalid field ids when reading packs.0966ebbb3Check pack field sizes against the bytes remaining in a buffer.950c1e149Error on zero-size pack fields.