std.compress.xz
: Integer overflows found via fuzzing
#14500
Labels
bug
Observed behavior contradicts documented or intended behavior
standard library
This issue involves writing Zig code for the standard library.
Milestone
Zig Version
0.11.0-dev.1502+d6b430b52
Steps to Reproduce and Observed Behavior
Meant to do some fuzz testing while this was still a PR (#14434) but didn't get around to it. So far I've only fuzz tested to find crashes, not verify correctness, and I've only found 3 unique integer overflow locations.
The minimized test cases as files can be found here (note: there are some test cases that trigger the same/similar crashes):
xz-fuzzed-crashes-20230202.zip
(if it makes it easier, it's possible to use zigescape to get Zig string literals from each file's contents)
The integer overflows can be reproduced by running the above inputs through the
decompress
function here:zig/lib/std/compress/xz/test.zig
Lines 5 to 12 in d6b430b
Fuzzer code can be found here:
https://github.com/squeek502/zig-std-lib-fuzzing/blob/master/fuzzers/xz.zig
cc @FnControlOption
Expected Behavior
The xz decompressor to avoid integer overflow on all inputs.
The text was updated successfully, but these errors were encountered: