-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite loop on malformed input #31
Comments
How did you detect the infinite loop with AFL here? Such a detection seems generally useful for some other fuzzing projects. |
AFL has categorized it as a hang. It monitors how much time has passed since execution for a given sample started and kills the process if it takes too long. The exact timeout is adjustable through a command-line parameter. |
Backtrace from gdb when entering infinite loop: I am not too used to this kind of debugging, but I am reasonably sure that it is hanging on one instruction, I step through in gdb, and then it suddenly stops. Could this error possibly come from outside of this crate?
|
Sadly I've never investigated anything like this using a debugger. I usually leave some disabled-by-default logging in the code to be able to see where execution goes and dump intermediate values. I'll see if I can capture an execution trace with |
Okay, I've recorded a trace with You can see that it does actually get to |
I've put a |
https://github.com/PistonDevelopers/image-tiff/blob/ff2621753477252e9a9abdb03edd6fef1808300b/src/decoder/stream.rs#L103-L105 doesn't break on Edit: I'm pretty sure this is Rusts worst API mistake, there should have been some encapsulation for this ^^ |
It should probably return |
I am working on a PR with a bunch of bug fixes, I will try too put a fix for this in it. |
Add test from fuzzing samples in image-rs#28, image-rs#29 and image-rs#31
Decoding these samples with
Decoder.read_image()
causes 100% CPU usage. I've run it for 10 minutes before giving up. The code is likely entering an infinite loop.The exact reproduction code can be found in #28. Found via AFL.rs, tested on
image-tiff
version 0.2.2The text was updated successfully, but these errors were encountered: