image-rs / jpeg-decoder

JPEG decoder written in Rust
Apache License 2.0
147 stars 88 forks source link

Revert 0xFF marker check #147

Closed ggopcceop closed 4 years ago

ggopcceop commented 4 years ago

I has some webcam from different venders that i use v4l2 to capture mjpg images to do some processing. When i used image-rs to decode some of the images, i got Error: IoError(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" }).

After some investigation i found that the https://github.com/image-rs/jpeg-decoder/blob/0c6f5a20801c9530fb99487a69ba39037ce15d0c/src/decoder.rs#L352 function skipped EOI marker when there is multiple 0xff before 0xD9.

And there is pull request from #100 that removed code to skip optional 0xff. So I added it back.

There is also a test image i took that have this error before. but I'm not sure where to put this image in the tests dir, since the crash test doest care decode result.

ggopcceop commented 4 years ago

Sorry about the confusion. And yes, I took that image my self, you have my consent to use the image freely.