Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upPanic on malformed input #79
Comments
added a commit
to Shnatsel/image-png
that referenced
this issue
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
Another panic on malformed input: out of bounds access on line Line 79 in 1266ec2 Found with cargo-fuzz. Testcase: I have a feeling that there's gonna be a lot of these, so I'm just going to put them all in this issue instead of creating a separate issue for each panic. |
added a commit
to Shnatsel/image-png
that referenced
this issue
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
There is an integer overflow in Line 51 in 9938365 Any unsafe code relying on this value being correct has a security vulnerability - either information disclosure or arbitrary code execution. The worst part is, fixing this correctly requires changing the external API: the function should use checked_mul() which returns Testcase: integer_overflow_in_multiplication found via afl-rs Update: this issue is complicated and fixing it requires a breaking change, so I have filed it separately as #80 |
added a commit
to Shnatsel/image-png
that referenced
this issue
Jun 27, 2018
This comment has been minimized.
This comment has been minimized.
|
There is a panic on Line 280 in 9938365 The code reads info for previous chunk instead of the current one. The fix in e221ae9 likely also fixes decoding of some real-world PNGs. Testcase: faulty_unwrap found via found via afl-rs. I've also committed updated AFL integration to my fork; it uses in-process fuzzing which is ~10x faster. |
This comment has been minimized.
This comment has been minimized.
|
There is overflow in left shift in Line 18 in 9938365 However, I do not know what behavior is correct in this case. Perhaps the overflow is expected and the operator should be replaced with overflowing left shift? Testcase: shift_left_with_overflow found via afl.rs |
This was referenced Jun 27, 2018
added a commit
to Shnatsel/image-png
that referenced
this issue
Jul 1, 2018
This comment has been minimized.
This comment has been minimized.
|
Fixed by #81 |

Shnatsel commentedJun 21, 2018
Previous fuzzing attempts did not bypass crc32 checks in
pngand adler32 checks ininflatecrates. Thus they never actually exercised the png decoding code.I have disabled checksum verification in fuzzing mode via conditional compilation and ran cargo-fuzz. I got a crash in less than a second.
Details on this specific panic: it happens at line https://github.com/PistonDevelopers/image-png/blob/1266ec2/src/decoder/mod.rs#L450
Steps to reproduce:
This repo uses my fork of image-png with crc32 conditionally disabled.
--cfg fuzzingin the above command disables it so that fuzzer-generated files can be tested. The file that's causing the crash is included in the repo and can be downloaded here.