From c60792dc47946cccabc6c77ce6cb98cbc1f0c134 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 18 Dec 2014 10:45:45 -0800 Subject: [PATCH] 8067050: Better font consistency checking Reviewed-by: bae, srl, mschoene --- .../share/native/libfontmanager/layout/LETableReference.h | 4 ++-- .../native/libfontmanager/layout/LigatureSubstSubtables.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h b/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h index 6afd3c1c13b..459d4e08806 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h +++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h @@ -150,8 +150,8 @@ public: if(isEmpty()) { //err = LE_MISSING_FONT_TABLE_ERROR; clear(); // it's just empty. Not an error. - } else if(offset >= fParent->fLength) { - LE_DEBUG_TR3("offset out of range: (%p) +%d", NULL, offset); + } else if(offset >= fParent->fLength || (offset & 0x01)) { + LE_DEBUG_TR3("offset out of range or odd alignment: (%p) +%d", NULL, offset); err = LE_INDEX_OUT_OF_BOUNDS_ERROR; clear(); } else { diff --git a/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp b/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp index 8e0e7cdd2b8..55209409578 100644 --- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp +++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp @@ -58,7 +58,7 @@ le_uint32 LigatureSubstitutionSubtable::process(const LETableReference &base, Gl if( LE_FAILURE(success) ) { return 0; } le_uint16 ligCount = SWAPW(ligSetTable->ligatureCount); - LEReferenceTo ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount); + LEReferenceToArrayOf ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount); for (le_uint16 lig = 0; LE_SUCCESS(success) && lig < ligCount; lig += 1) { Offset ligTableOffset = SWAPW(ligSetTable->ligatureTableOffsetArray[lig]); LEReferenceTo ligTable(ligSetTable, success, ligTableOffset);