Closed jdm closed 8 years ago
Wow, thanks! I'll investigate it ASAP. Is there a direct link to the offending image?
Not yet; sorry.
The image appears to be data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==
interestingly enough.
The jpeg loader was only tried because the webp one didn't return an Ok value, apparently.
&['R', 'I', 'F', 'F', 'J', '\0', '\0', '\0', 'W', 'E', 'B', 'P', 'V', 'P', '8', 'X', '\n', '\0', '\0', '\0', '\x10', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', 'A', 'L', 'P', 'H', '\f', '\0', '\0', '\0', '\x01', '\a', '\x10', '\x11', '�', '\x0f', 'D', 'D', '�', '\x03', '\0', '\0', 'V', 'P', '8', ' ', '\x18', '\0', '\0', '\0', '0', '\x01', '\0', '\x9d', '\x01', '*', '\x01', '\0', '\x01', '\0', '\x03', '\0', '4', '%', '�', '\0', '\x03', 'p', '\0', '�', '�', '�', 'P', '\0']
@jdm Thanks! Indeed this could happen, webp support is not full yet. Apparently it has VP8X
chunk id which is not supported now. Do you want a quick fix which disables webp support for now or are you willing to wait until I add support for other webp chunk formats? I'll start working on it right away in the latter case, will probably finish it right after the weekend.
Perhaps make webp support a feature that can be enabled by users of the library? It would still be useful to harden the jpeg decoder to avoid this, too.
a feature
This somehow didn't even occur to me. Indeed, that would be a nice solution, thanks!
It would still be useful to harden the jpeg decoder to avoid this, too.
Yes, I agree. Unfortunately, JPEG is such a loose format that it is pretty hard to do it... I'll see what I can do.
Apparently I was wrong about the looseness of the JPEG format. I finally have found its specification, and I was able to improve the JPEG parser considerably. It does not contain the overflow problem anymore, and it also provides more pieces of metadata. See version 0.3.4.
immeta will now return "unsupported image format" error for the image in question. @jdm please tell if this is an acceptable behavior.
Perfect!
Okay, then I'll close this. Thanks!
This is https://github.com/netvl/immeta/blob/f06b1fd1fc13184cf2834e009853117b7c557a74/src/formats/jpeg.rs#L37 . Presumably we end up with 1 or 0.