On Fri, 16 Oct 2026 19:39:56 GMT, Phil Race <[email protected]> wrote:
>>>8 bit samples is what is important. Progressive 8 bit does not change
>>>anything.
>>
>> I think we talk about different things. My initial point was only this:
>>>So I do not think this is accurate:
>>>ImageIO's native JPEG library is compiled to support baseline JPEG only.
>>>This means 8 bit quantization values in the range 1 -> 255.
>>
>> "baseline JPEG only" in that text is not correct. The library is not
>> compiled for baseline only, otherwise progressive would have to be dropped
>> as well. It is compiled for 8 bit samples, and that is what the PR
>> description should say, and that is what I pointed out, so that argument is
>> not used as a reason later.
>>
>> It would be good to document this in JBS and possibly by the release-note,
>> since this is a behavior change (dropping an extended behavior of libjpeg),
>> not only a bug fix.
>>
>>>What crash ? I'm not seeing any crash, nor fixing a crash.
>>
>> ... as usual bugs just stick to me....
>> I thought this clamp was a guard, and checking that code path I found that
>> with some specific values it causes a crash. Your "< 1" clamp fixes it.
>
> I changed the description to say "8 bit samples"
>
> Do you have a test that shows this crash ?
>
> I experimented just now with only clamping the < 1 .. but of course my new
> test fails with that because the *existing* behaviour of the plugin is to
> throw an Exception when reading a JPEG with 16-bit quantization data.
>
> And by not clamping on write, that's what is there to be read.
>
> I could make it do the < 1 clamp on read AND write, but only do the 255 clamp
> on write.
>
>
> - if (q > 255) { // ImageIO supports baseline only
> + if ((q > 255) && !cinfo->is_decompressor) { // ImageIO supports
> 8 bit samples only
> q = 255;
> }
>
>
> in which case the test would pass.
I was distracted by some urgent releases, but I’ll take a look at this PR soon.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33217#discussion_r4394050381