On Fri, 6 Nov 2026 11:53:44 GMT, Timofei Fedotov <[email protected]> wrote:

>> The legacy AWT JPEG decoder can write a synthetic two-byte JPEG EOI marker 
>> beyond the input buffer in sun_jpeg_fill_suspended_buffer().
>> 
>> The function retains unconsumed input bytes and reads into the remaining 
>> space. Its capacity check permits one remaining byte, but the EOF path 
>> writes two bytes. With a 1024-byte input buffer, offset 1023, and read() 
>> returning EOF, the second marker byte is written at index 1024. The path 
>> also requires available() to report more bytes than remaining_skip before 
>> the read; a stream whose availability estimate is inconsistent with the 
>> subsequent EOF can satisfy this condition.
>> 
>> Truncated input must be rejected or handled without writing outside the 
>> input array.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Timofei Fedotov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Handle invalid JPEG input buffer state in the caller

test/jdk/sun/awt/image/SyntheticEOIMarkerBufferTest.java line 20:

> 18:  *
> 19:  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
> 20:  * or visit www.oracle.com if you have any questions.

This is failing our validation build which expects some additional words in 
that last sentence.

Comparing with another test in the same directory

% diff SyntheticEOIMarkerBufferTest.java bug8038000.java


<  * or visit www.oracle.com if you have any questions.
---
>  * or visit www.oracle.com if you need additional information or have any
>  * questions.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33313#discussion_r4497164123

Reply via email to