[OpenJDK 2D-Dev] RFR: 8132850: java.lang.ArrayIndexOutOfBoundsException during text rendering with many fonts installed

Jennifer Godinez jennifer.godinez at oracle.com
Thu Aug 13 16:36:15 UTC 2015


Hi Phil,

Looks good.

Jennifer

On 8/12/15 2:01 PM, Phil Race wrote:
> Hi all,
>
> Still looking for any reviewers for this 7 day old review ...
>
> -phil.
>
> On 8/5/15 12:15 PM, Phil Race wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8132850
>> http://cr.openjdk.java.net/~prr/8132850/
>>
>> The bug is an ArrayIndexOutofBoundsException when a very large set of 
>> fonts are installed on Linux.
>> It occurred rendering from a compositefont :
>>
>> Exception in thread "AWT-EventQueue-0" 
>> java.lang.ArrayIndexOutOfBoundsException: -35127285
>>     at 
>> sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:520)
>>     at 
>> sun.font.FileFontStrike.setCachedGlyphPtr(FileFontStrike.java:537)
>>     at 
>> sun.font.FileFontStrike.getSlot0GlyphImagePtrs(FileFontStrike.java:449)
>>     at 
>> sun.font.CompositeStrike.getGlyphImagePtrs(CompositeStrike.java:115)
>>     at sun.font.GlyphList.mapChars(GlyphList.java:272)
>>
>> Note that you do not see the exception on JDK 9 because it is caught 
>> as a  result of
>> some other work, but it is seen on 8, and the underlying problems 
>> affect all releases.
>>
>> There are several contributing problems :
>>
>> - the native fontconfig code to accumulate the fonts was resetting 
>> the set of glyphs for each time through the loop.
>>  thus its heuristic to limit the number of slots was never met and so 
>> it would add more slots than it should.
>>  In addition it should limit to 256 (or fewer) anyway.
>>
>> - a special case in FileFontStrike accepted a composite glyph id. 
>> These use the MS byte of the int to store
>> a slot. Once it was > 127 then the test to see if the glyph was a 
>> slot zero glyph failed. Hence the AIIOB.
>>
>> - finally for extra safety the CompositeFont constructor should 
>> ignore trailing slots that will not fit.
>>
>> I could not devise a regression test since its requires a custom 
>> system config
>> and in any case the exception is not seen on 9 as noted above.
>>
>> -phil.
>




More information about the 2d-dev mailing list