Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8189092: ArrayIndexOutOfBoundsException on Linux in getCachedGlyph #24

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -92,6 +92,9 @@ public final int compositeGlyphCode(int slot, int glyphCode) {

private final int convertToGlyph(int unicode) {
for (int slot = 0; slot < font.getNumSlots(); slot++) {
if (slot >= 255) { // not supposed to happen.
return missingGlyph;
}
CharToGlyphMapper mapper = getSlotMapper(slot);
int glyphCode = mapper.charToGlyph(unicode);
if (glyphCode != mapper.getMissingGlyphCode()) {
@@ -69,6 +69,7 @@
// segmented arrays are in blocks of 32 glyphs.
private static final int SEGSHIFT = 5;
private static final int SEGSIZE = 1 << SEGSHIFT;
private static final int SEGMASK = SEGSIZE - 1;
HashMap<Integer, GlyphData[]>
glyphDataMap = new HashMap<Integer, GlyphData[]>();

@@ -238,8 +239,8 @@ private void clearAll() {
}

private GlyphData getCachedGlyph(int glyphCode, int subPixel) {
int segIndex = glyphCode >> SEGSHIFT;
int subIndex = glyphCode % SEGSIZE;
int segIndex = glyphCode >>> SEGSHIFT;
int subIndex = glyphCode & SEGMASK;
segIndex |= (subPixel << SUBPIXEL_SHIFT);
GlyphData[] segment = glyphDataMap.get(segIndex);
if (segment != null) {
@@ -402,10 +402,11 @@ Java_com_sun_javafx_font_FontConfigManager_getFontConfig
}
fontCount = 0;
minGlyphs = 20;
FcCharSet *unionCharset = NULL;
for (j=0; j<nfonts; j++) {
FcPattern *fontPattern = fontset->fonts[j];
FcChar8 *fontformat;
FcCharSet *unionCharset = NULL, *charset;
FcCharSet *charset;

fontformat = NULL;
(*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
@@ -456,6 +457,13 @@ Java_com_sun_javafx_font_FontConfigManager_getFontConfig
if (!includeFallbacks) {
break;
}
if (fontCount == 254) {
/* Upstream Java code currently stores this in a byte;
* And we need one slot free for when this sequence is
* used as a fallback sequeunce.
*/
break;
}
}

/* Once we get here 'fontCount' is the number of returned fonts
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.