<AWT Dev> RFR: 8211826: StringIndexOutOfBoundsException happens via GetStringUTFRegion()

Ichiroh Takiguchi takiguc at linux.vnet.ibm.com
Thu Mar 28 13:27:20 UTC 2019


Sorry for bad response.

Could you review the fix ?

Bug:    https://bugs.openjdk.java.net/browse/JDK-8211826
Change: https://cr.openjdk.java.net/~itakiguchi/8211826/webrev.01/

Following changes are applied:
* Issue title was changed on JBS.
* Attached testcase was changed and add a fix for swing_GTKEngine.c.
* On swing_GTKEngine.c, maximum length size for String data is arranged.
     -static char conversionBuffer[CONV_BUFFER_SIZE];
     +static char conversionBuffer[(CONV_BUFFER_SIZE - 1) * 3 + 1];

I'd like to obtain a sponsor for this issue.

Ichiroh Takiguchi

On 2018-11-10 11:02, Sergey Bylokhov wrote:
> Hi, Ichiroh.
> The changes looks good, i think that the test from
> the bug description can be integrated as well.
>> Note that, 
>> src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c has 
>> same kind of code.
>> But buffer handling is not same, so I could not determine, I need to 
>> change swing_GTKEngine.c or not.
> I think that in swing_GTKEngine.c we have an opposite
> problem when we use the java length as the size of the array,
> so GetStringUTFRegion may overrun the conversionBuffer.
> BTW I think we need to clean conversionBuffer before each usage.

More information about the awt-dev mailing list