maintainer-feedback requested: [Bug 265663] java/openjdk17: problem with jpeg-turbo?

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 05 Aug 2022 18:26:10 UTC
Bugzilla Automation <bugzilla@FreeBSD.org> has asked freebsd-java (Nobody)
<java@FreeBSD.org> for maintainer-feedback:
Bug 265663: java/openjdk17: problem with jpeg-turbo?
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265663



--- Description ---
I recently upgraded from openjdk-8 to openjdk-17, and noticed that JPEG files
that were previously opening succesfully were now failing with:

```
Exception in thread "main" javax.imageio.IIOException: Bogus virtual array
access
	at
java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native
Method)
	at
java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown
Source)
	at
java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)
	at java.desktop/javax.imageio.ImageIO.read(Unknown Source)
	at java.desktop/javax.imageio.ImageIO.read(Unknown Source)
	at ImageExceptionMain.main(ImageExceptionMain.java:10)

```

I could reproduce this as well on the default Arch Linux openjdk17, and could
reproduce it as well on openjdk 11.

Both appear to use the system libjpeg (jpeg-turbo) instead of the bundled one.
If I change the port Makefile and remove:
```
    --with-libjpeg=system
```
, (implying `--with-libjpeg=bundled`), then everything works.

I could not find a jpeg-turbo binary that shows a problem, nor get any other
image program to complain about the (attached) file and suggest it is somehow
invalid.

I have attached a source file and image file (no affiliation to whatever it is
saying) to reproduce this issue.