Fixing incorrectly generated header for `jfif-and-exif.jpg` to support JDK 
built with `--with-libjpeg=system`. 

The test fixture jfif-and-exif.jpg (added by JDK-8160327) currently is a 
malformed JPEG. Builds that bundle OpenJDK's libjpeg pass because the 
jdmarker.c leniency patch (JDK-4511441) lets the reader skip the resulting 
bogus marker and resync. Builds configured --with-libjpeg=system reject it with 
`javax.imageio.IIOException: Unsupported marker type 0xf7`

The core of the issue seems to be a stale test resource, not a product bug. 
JDK-8351110 later added a guard to the JFIF writer so it can no longer emit a 
thumbnail that overflows the header length, which confirms the checked-in 
fixture is invalid. Here I'm regenerating the header correctly and fixing the 
test size.

Testing:
* GHA Sanity Checks
* Adjusted `JpegExifThumbnailTest.java` test using builds with and without 
`--with-libjpeg=system`

---------
- [X] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8396848: JpegExifThumbnailTest.java fails with system libjpeg due to 
malformed jfif-and-exif.jpg

Changes: https://git.openjdk.org/jdk/pull/33759/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33759&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8396848
  Stats: 5 lines in 2 files changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/33759.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/33759/head:pull/33759

PR: https://git.openjdk.org/jdk/pull/33759

Reply via email to