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
Legacy Blackberry JPEGs with embedded TIFFs report "Premature end of JPEG file" #591
Comments
That libjpeg warning means exactly what it says: the decoder ran out of JPEG data to decode. All versions of libjpeg behave exactly the same way with the test image, so I fail to see why this is our bug. |
Generally speaking, libjpeg-turbo should handle or at least ignore TIFF data stored in EXIF, but if the encoder is storing the data as TIFF/JPEG, then libjpeg-turbo can't handle it. The IJG README file says as much: Lines 221 to 222 in df3c3dc
|
I am not a graphics guy and don't know the details, but would not mind better understanding, why you are returning this status in the case of these files? |
I haven't looked at it closely, but it appears as if libjpeg-turbo (and libjpeg) legitimately cannot decode a section of data between the Start of Scan and End of Image markers. That is also where the valid image data resides, so I don't know how libjpeg-turbo would distinguish between the two. It would be safe to ignore the warning in this case, but ignoring libjpeg API warnings isn't necessarily a safe practice for applications, such as browsers, that have to handle arbitrary data. Unfortunately, I can't comment more intelligently without understanding exactly what the encoder is doing. If it is implementing some form of TIFF/JPEG encoding, then libjpeg-turbo won't be able to read that (but libtiff might.) It appears as if |
Have you searched the existing issues (both open and closed) in the libjpeg-turbo issue tracker to ensure that this bug report is not a duplicate?
YES
Does this bug report describe one of the two known and unsolvable issues with the JPEG format?
NO
Clear and concise description of the bug:
Processing legacy Blackberry JPEG images with embedded TIFFs reports "Premature end of JPEG file".
This causes failure of some downstream products specifically Google libwebp - which points fingers upstream: Issue 562 in webp: Blackberry photo in jpeg with embedded TIFF image fails to convert to webp
Steps to reproduce the bug (using only libjpeg-turbo):
Image(s) needed in order to reproduce the bug (if applicable):
Others available if required, preferably via private share or DM.
Expected behavior:
End Of Image
report normal end of file.
Observed behavior:
and presumably equivalent in the library and downstream products, some of which save the resulting files, others just quit processing.
Platform(s) (compiler version, operating system version, CPU) on which the bug was observed:
newlib 4.3 (Cygwin libc)
Windows 10 Home 21H2/[20]2009/10.0.19044.1586
libjpeg-turbo release(s), commit(s), or branch(es) in which the bug was observed (always test the tip of the main branch or the latest stable pre-release to verify that the bug hasn't already been fixed):
libjpeg-turbo 2.1.2 (latest not quite yet available on Cygwin)
If the bug is a regression, the specific commit that introduced the regression (use
git bisect
to determine this):Additional information:
The text was updated successfully, but these errors were encountered: