xiaozhuai / imageinfo

Free Palestine🇵🇸🇵🇸🇵🇸Cross platform super fast single header c++ library to get image size and format without loading/decoding. Support avif, bmp, cur, dds, gif, hdr (pic), heic (heif), icns, ico, j2k, jp2, jpeg (jpg), jpx, ktx, png, psd, qoi, tga, tiff (tif), webp ...
MIT License
106 stars 26 forks source link

JPEG contains garbge bytes #4

Closed hgourvest closed 8 months ago

hgourvest commented 8 months ago

Yakari T01-0000 in this jpeg file, there's a section with comment text (FF FE) of size 3 bytes, unfortunately, it seems that the minimum size of a section is 4 bytes, so the next iteration moves the cursor to the wrong place.

xiaozhuai commented 8 months ago

it seems that the minimum size of a section is 4 bytes

This is not true.

Em...I looked into it and found something intresting. You can insert any bytes between sections (except FF). It won't damage jpg. Here I insert 7 bytes 0A.

image

Since every section start with FF, so the correct way may be skipping the garbge bytes.

What's your suggestion?

xiaozhuai commented 8 months ago

image And I looked into 010 editor's template code. It also treat these bytes as garbge and just skip them. I'll fix this soon.

xiaozhuai commented 8 months ago

Fix in https://github.com/xiaozhuai/imageinfo/commit/8f94e1f68d6b40a535090aac696be7a43cc1df61 Thanks for reporting this.

xiaozhuai commented 8 months ago

@hgourvest Since this issue is solved, I'm going to close it as completed. Feel free to reopen if you'd like to discuss further.

hgourvest commented 8 months ago

Thank you very much for the quick fix. I appreciate your work.