8132850: java.lang.ArrayIndexOutOfBoundsException during text rendering with many fonts installed
Reviewed-by: jgodinez, serb
This commit is contained in:
parent
298ef6a50e
commit
3774d9b151
@ -71,6 +71,13 @@ public final class CompositeFont extends Font2D {
|
|||||||
} else {
|
} else {
|
||||||
numSlots = componentNames.length;
|
numSlots = componentNames.length;
|
||||||
}
|
}
|
||||||
|
/* We will limit the number of slots to 254.
|
||||||
|
* We store the slot for a glyph id in a byte and we may use one slot
|
||||||
|
* for an EUDC font, and we may also create a composite
|
||||||
|
* using this composite as a backup for a physical font.
|
||||||
|
* So we want to leave space for the two additional slots.
|
||||||
|
*/
|
||||||
|
numSlots = (numSlots <= 254) ? numSlots : 254;
|
||||||
|
|
||||||
/* Only the first "numMetricsSlots" slots are used for font metrics.
|
/* Only the first "numMetricsSlots" slots are used for font metrics.
|
||||||
* the rest are considered "fallback" slots".
|
* the rest are considered "fallback" slots".
|
||||||
|
@ -420,14 +420,13 @@ public class FileFontStrike extends PhysicalStrike {
|
|||||||
|
|
||||||
/* The following method is called from CompositeStrike as a special case.
|
/* The following method is called from CompositeStrike as a special case.
|
||||||
*/
|
*/
|
||||||
private static final int SLOTZEROMAX = 0xffffff;
|
|
||||||
int getSlot0GlyphImagePtrs(int[] glyphCodes, long[] images, int len) {
|
int getSlot0GlyphImagePtrs(int[] glyphCodes, long[] images, int len) {
|
||||||
|
|
||||||
int convertedCnt = 0;
|
int convertedCnt = 0;
|
||||||
|
|
||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
int glyphCode = glyphCodes[i];
|
int glyphCode = glyphCodes[i];
|
||||||
if (glyphCode >= SLOTZEROMAX) {
|
if (glyphCode >>> 24 != 0) {
|
||||||
return convertedCnt;
|
return convertedCnt;
|
||||||
} else {
|
} else {
|
||||||
convertedCnt++;
|
convertedCnt++;
|
||||||
|
@ -1219,10 +1219,11 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
minGlyphs = val;
|
minGlyphs = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FcCharSet *unionCharset = NULL;
|
||||||
for (j=0; j<nfonts; j++) {
|
for (j=0; j<nfonts; j++) {
|
||||||
FcPattern *fontPattern = fontset->fonts[j];
|
FcPattern *fontPattern = fontset->fonts[j];
|
||||||
FcChar8 *fontformat;
|
FcChar8 *fontformat;
|
||||||
FcCharSet *unionCharset = NULL, *charset;
|
FcCharSet *charset = NULL;
|
||||||
|
|
||||||
fontformat = NULL;
|
fontformat = NULL;
|
||||||
(*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
|
(*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
|
||||||
@ -1280,6 +1281,9 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
if (!includeFallbacks) {
|
if (!includeFallbacks) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (fontCount == 254) {
|
||||||
|
break; // CompositeFont will only use up to 254 slots from here.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once we get here 'fontCount' is the number of returned fonts
|
/* Once we get here 'fontCount' is the number of returned fonts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user