# HG changeset patch # User prr # Date 1387214807 28800 # Node ID fdbaab67db73fc944c8b86929d0cf8c407645ec1 # Parent 42205a8f63f3bf499c93d8a4d6fa77ed240b1e65 8027775: Enhance ICU code. Reviewed-by: srl, bae, mschoene diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp --- a/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -154,6 +154,7 @@ TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid); if ((glyphCode >= firstGlyph) && (glyphCode < lastGlyph)) { LEReferenceToArrayOf valueArray(lookupTable8, success, &lookupTable8->valueArray[0], glyphCount); + if (LE_FAILURE(success)) { return newGlyph; } newGlyph = SWAPW(valueArray(glyphCode - firstGlyph, success)); } } diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp --- a/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -110,6 +110,8 @@ LEErrorCode &success, le_bool backtrack) { + if (LE_FAILURE(success)) { return FALSE; } + le_int32 direction = 1; le_int32 match = 0; @@ -255,6 +257,7 @@ le_uint16 matchCount = SWAPW(subRuleTable->glyphCount) - 1; le_uint16 substCount = SWAPW(subRuleTable->substCount); LEReferenceToArrayOf inputGlyphArray(base, success, subRuleTable->inputGlyphArray, matchCount+2); + if (LE_FAILURE(success)) { return 0; } if (matchGlyphIDs(inputGlyphArray, matchCount, glyphIterator)) { LEReferenceToArrayOf substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subRuleTable->inputGlyphArray[matchCount], substCount); @@ -315,6 +318,7 @@ LEReferenceToArrayOf classArray(base, success, subClassRuleTable->classArray, matchCount+1); + if (LE_FAILURE(success)) { return 0; } if (matchGlyphClasses(classArray, matchCount, glyphIterator, classDefinitionTable, success)) { LEReferenceToArrayOf substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount], substCount); @@ -573,7 +577,7 @@ if (matchGlyphClasses(inputClassArray, inputGlyphCount, glyphIterator, inputClassDefinitionTable, success)) { LEReferenceToArrayOf substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) lookaheadClassArray.getAlias(lookaheadGlyphCount + 1, success), substCount); - + if (LE_FAILURE(success)) { return 0; } applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success); return inputGlyphCount + 1; @@ -601,9 +605,10 @@ le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount); le_uint16 inputGlyphCount = (le_uint16) SWAPW(backtrackCoverageTableOffsetArray[backtrkGlyphCount]); LEReferenceToArrayOf inputCoverageTableOffsetArray(base, success, &backtrackCoverageTableOffsetArray[backtrkGlyphCount + 1], inputGlyphCount+2); // offset + if (LE_FAILURE(success)) { return 0; } const le_uint16 lookaheadGlyphCount = (le_uint16) SWAPW(inputCoverageTableOffsetArray[inputGlyphCount]); - if( LE_FAILURE(success) ) { return 0; } + if( LE_FAILURE(success)) { return 0; } LEReferenceToArrayOf lookaheadCoverageTableOffsetArray(base, success, inputCoverageTableOffsetArray.getAlias(inputGlyphCount + 1, success), lookaheadGlyphCount+2); if( LE_FAILURE(success) ) { return 0; } diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/LookupProcessor.cpp --- a/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/LookupProcessor.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -282,6 +282,7 @@ for (le_uint16 feature = 0; feature < featureCount; feature += 1) { LEReferenceToArrayOf featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount); + if (LE_FAILURE(success)) { continue; } le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success)); // don't add the required feature to the list more than once... diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp --- a/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -67,6 +67,7 @@ LEPoint markAnchor; LEReferenceTo markArray(base, success, (const MarkArray *) ((char *) this + SWAPW(markArrayOffset))); + if(LE_FAILURE(success)) return 0; le_int32 markClass = markArray->getMarkClass(markArray, markGlyph, markCoverage, fontInstance, markAnchor, success); le_uint16 mcCount = SWAPW(classCount); diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp --- a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -79,8 +79,8 @@ Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf &records, LEErrorCode &success) { + if(LE_FAILURE(success)) return 0; const TagAndOffsetRecord *r0 = (const TagAndOffsetRecord*)records.getAlias(); - if(LE_FAILURE(success)) return 0; le_uint32 recordCount = records.getCount(); le_uint8 bit = highBit(recordCount); diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp --- a/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -73,6 +73,7 @@ if (offset != 0) { LEReferenceToArrayOf glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY); + if (LE_FAILURE(success)) { continue; } TTGlyphID newGlyph = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success)); glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); } diff -r 42205a8f63f3 -r fdbaab67db73 jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp --- a/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp Wed Jan 22 09:42:51 2014 -0800 +++ b/jdk/src/share/native/sun/font/layout/StateTableProcessor.cpp Mon Dec 16 09:26:47 2013 -0800 @@ -97,6 +97,7 @@ LEReferenceToArrayOf stateArray(stHeader, success, currentState, LE_UNBOUNDED_ARRAY); EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success); + if (LE_FAILURE(success)) { break; } LE_STATE_PATIENCE_CURR(le_int32, currGlyph); currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex); LE_STATE_PATIENCE_INCR(currGlyph);