On Wed, 14 Oct 2026 20:11:43 GMT, Phil Race <[email protected]> wrote:

>Yes it does. I referenced the exact place in the JPEG spec that requires it.
> any use of 16 bit quantization with 8 bit samples is a bug in what ever 
> provides it or whatever allows it.

That is correct. But neither "8 bit samples" nor this clamp makes the plugin 
baseline-only, before or after the patch. It is not, since progressive is 
supported. So the reason of the fix should be updated: not "ImageIO's native 
JPEG library is compiled to support baseline JPEG only", but "drop the libjpeg 
extension (16 bit quantization tables for 8 bit samples) which the plugin 
supported since 1.4". Baseline has nothing to do with it, and that is a 
behavior change.

If the clamp on the read path is a guard against values outside 1..255, it does 
not work: the table stored in the image is read by libjpeg itself and reaches 
the decoder as is, the code change in this PR never sees it. To guard that the 
library must be changed, which is impossible with the system libjpeg. And the 
decoder does not need it, it only multiplies by the table, the crash is in the 
encoder. So the clamp might be applied on write only.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33217#discussion_r4276358481

Reply via email to