diff --git a/jdk/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.cpp b/jdk/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.cpp index 5b99174b150..ccbc0523d3b 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.cpp +++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/SingleSubstitutionSubtables.cpp @@ -94,7 +94,9 @@ le_uint32 SingleSubstitutionFormat2Subtable::process(const LEReferenceTo= 0) { + LEReferenceToArrayOf substituteArrayRef(base, success, substituteArray, SWAPW(glyphCount)); + + if (coverageIndex >= 0 && LE_SUCCESS(success) && coverageIndex < substituteArrayRef.getCount()) { TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]); if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute), success)) {