From fe90dfe8f961edcff2b7d6b1e15f200a36b6e492 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Thu, 26 Feb 2015 23:31:47 +0000 Subject: [PATCH] ICU-11525 apply contributed patches to layout engine. X-SVN-Rev: 37086 --- icu4c/source/layout/ContextualSubstSubtables.cpp | 8 +++++++- icu4c/source/layout/CursiveAttachmentSubtables.cpp | 7 +++++-- icu4c/source/layout/Features.cpp | 5 ++++- icu4c/source/layout/LETableReference.h | 9 +++++++-- icu4c/source/layout/LigatureSubstSubtables.cpp | 5 ++++- icu4c/source/layout/MultipleSubstSubtables.cpp | 7 ++++++- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/icu4c/source/layout/ContextualSubstSubtables.cpp b/icu4c/source/layout/ContextualSubstSubtables.cpp index 1737d8e922..4c066f1e8c 100644 --- a/icu4c/source/layout/ContextualSubstSubtables.cpp +++ b/icu4c/source/layout/ContextualSubstSubtables.cpp @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved * */ @@ -466,6 +466,12 @@ le_uint32 ChainingContextualSubstitutionFormat2Subtable::process(const LookupPro const ChainSubClassRuleTable *chainSubClassRuleTable = (const ChainSubClassRuleTable *) ((char *) chainSubClassSetTable + chainSubClassRuleTableOffset); le_uint16 backtrackGlyphCount = SWAPW(chainSubClassRuleTable->backtrackGlyphCount); + + // TODO: Ticket #11557 - enable this check, originally from ticket #11525. + // Depends on other, more extensive, changes. + // LEReferenceToArrayOf backtrackClassArray(base, success, chainSubClassRuleTable->backtrackClassArray, backtrackGlyphCount); + if( LE_FAILURE(success) ) { return 0; } + le_uint16 inputGlyphCount = SWAPW(chainSubClassRuleTable->backtrackClassArray[backtrackGlyphCount]) - 1; const le_uint16 *inputClassArray = &chainSubClassRuleTable->backtrackClassArray[backtrackGlyphCount + 1]; le_uint16 lookaheadGlyphCount = SWAPW(inputClassArray[inputGlyphCount]); diff --git a/icu4c/source/layout/CursiveAttachmentSubtables.cpp b/icu4c/source/layout/CursiveAttachmentSubtables.cpp index 875c1b1d7e..485c963605 100644 --- a/icu4c/source/layout/CursiveAttachmentSubtables.cpp +++ b/icu4c/source/layout/CursiveAttachmentSubtables.cpp @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 1998 - 2013 - All Rights Reserved + * (C) Copyright IBM Corp. 1998 - 2015 - All Rights Reserved * */ @@ -20,7 +20,10 @@ le_uint32 CursiveAttachmentSubtable::process(const LEReferenceTo= eeCount) { + LEReferenceToArrayOf + entryExitRecordsArrayRef(base, success, entryExitRecords, coverageIndex); + + if (coverageIndex < 0 || coverageIndex >= eeCount || LE_FAILURE(success)) { glyphIterator->setCursiveGlyph(); return 0; } diff --git a/icu4c/source/layout/Features.cpp b/icu4c/source/layout/Features.cpp index fbffe55599..74e2030c44 100644 --- a/icu4c/source/layout/Features.cpp +++ b/icu4c/source/layout/Features.cpp @@ -1,7 +1,7 @@ /* * @(#)Features.cpp 1.4 00/03/15 * - * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved * */ @@ -15,6 +15,9 @@ U_NAMESPACE_BEGIN LEReferenceTo FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const { + LEReferenceToArrayOf + featureRecordArrayRef(base, success, featureRecordArray, featureIndex); + if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) { return LEReferenceTo(); } diff --git a/icu4c/source/layout/LETableReference.h b/icu4c/source/layout/LETableReference.h index f7eb79b2e8..de51228ead 100644 --- a/icu4c/source/layout/LETableReference.h +++ b/icu4c/source/layout/LETableReference.h @@ -1,7 +1,7 @@ /* * -*- c++ -*- * - * (C) Copyright IBM Corp. and others 2013 - All Rights Reserved + * (C) Copyright IBM Corp. and others 2015 - All Rights Reserved * * Range checking * @@ -313,7 +313,12 @@ LE_TRACE_TR("INFO: new RTAO") const T *getAliasRAW() const { LE_DEBUG_TR("getAliasRAW<>"); return (const T*)fStart; } const T& getObject(le_uint32 i, LEErrorCode &success) const { - return *getAlias(i,success); + const T *ret = getAlias(i, success); + if (LE_FAILURE(success) || ret==NULL) { + return *(new T(0)); + } else { + return *ret; + } } const T& operator()(le_uint32 i, LEErrorCode &success) const { diff --git a/icu4c/source/layout/LigatureSubstSubtables.cpp b/icu4c/source/layout/LigatureSubstSubtables.cpp index 6e278e390c..16d61ed174 100644 --- a/icu4c/source/layout/LigatureSubstSubtables.cpp +++ b/icu4c/source/layout/LigatureSubstSubtables.cpp @@ -1,5 +1,5 @@ /* - * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved * */ @@ -27,6 +27,9 @@ le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, Gl Offset ligTableOffset = SWAPW(ligSetTable->ligatureTableOffsetArray[lig]); const LigatureTable *ligTable = (const LigatureTable *) ((char *)ligSetTable + ligTableOffset); le_uint16 compCount = SWAPW(ligTable->compCount) - 1; + LEReferenceToArrayOf + componentArrayRef(base, success, ligTable->componentArray, compCount); + if (LE_FAILURE(success)) { return 0; } le_int32 startPosition = glyphIterator->getCurrStreamPosition(); TTGlyphID ligGlyph = SWAPW(ligTable->ligGlyph); le_uint16 comp; diff --git a/icu4c/source/layout/MultipleSubstSubtables.cpp b/icu4c/source/layout/MultipleSubstSubtables.cpp index 7ff155beef..4fdc0a4dc7 100644 --- a/icu4c/source/layout/MultipleSubstSubtables.cpp +++ b/icu4c/source/layout/MultipleSubstSubtables.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved * */ @@ -35,7 +35,12 @@ le_uint32 MultipleSubstitutionSubtable::process(const LETableReference &base, Gl le_int32 coverageIndex = getGlyphCoverage(base, glyph, success); le_uint16 seqCount = SWAPW(sequenceCount); + LEReferenceToArrayOf + sequenceTableOffsetArrayRef(base, success, sequenceTableOffsetArray, seqCount); + if (LE_FAILURE(success)) { + return 0; + } if (coverageIndex >= 0 && coverageIndex < seqCount) { Offset sequenceTableOffset = SWAPW(sequenceTableOffsetArray[coverageIndex]); const SequenceTable *sequenceTable = (const SequenceTable *) ((char *) this + sequenceTableOffset);