Skip to content
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

Slow parsing for small inputs #134

Open
dbrgn opened this issue Feb 12, 2020 · 1 comment
Open

Slow parsing for small inputs #134

dbrgn opened this issue Feb 12, 2020 · 1 comment

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Feb 12, 2020

Here's a case that I believe is different from #133: Running this 504 byte input file through the decode function takes ~30 seconds in release mode (at about 170% CPU load according to htop) until it fails with Io(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" }).

id:000010,sig:06,src:000016,op:flip32,pos:163.tar.gz

To reproduce, in the afl branch (#131), run:

$ time cargo run --release --bin reproduce_decode out/crashes/id:000010,sig:06,src:000016,op:flip32,pos:163
    Finished release [optimized] target(s) in 0.01s
     Running `target/release/reproduce_decode 'out/crashes/id:000010,sig:06,src:000016,op:flip32,pos:163'`
Decoder returned an error: Io(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" })
Note: Not a panic, this is fine.

real	0m29.794s
user	0m50.215s
sys	0m2.310s

While running, according to htop, the process does not fill my system memory, that's why I think it's not limited to the "unchecked pre-allocation" issue.

(I hope I don't annoy you with all those issues. Without knowledge of the internals it's hard to judge which cases are duplicates and which cases aren't 🙂 Thanks for developing and maintaining jpeg-decoder!)

@kaj
Copy link
Member

kaj commented Feb 12, 2020

It's similar at least in that it is a small file claiming to encode a very large (65503x65503 pixel, in this case) image.

I may have sounded a bit dissmisive at some of your report, but I do think they are valuable. At least they underline the need for a good solution to image-rs/image#938 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants