8067050: Better font consistency checking
authorprr
Thu, 18 Dec 2014 10:45:45 -0800
changeset 29908 83e2c403fefd
parent 29907 1eff5aab118f
child 29909 388fe481deeb
8067050: Better font consistency checking Reviewed-by: bae, srl, mschoene
jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h
jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Thu Dec 18 10:45:02 2014 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Thu Dec 18 10:45:45 2014 -0800
@@ -150,8 +150,8 @@
       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 {
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp	Thu Dec 18 10:45:02 2014 -0800
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp	Thu Dec 18 10:45:45 2014 -0800
@@ -58,7 +58,7 @@
         if( LE_FAILURE(success) ) { return 0; }
         le_uint16 ligCount = SWAPW(ligSetTable->ligatureCount);
 
-        LEReferenceTo<Offset> ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount);
+        LEReferenceToArrayOf<Offset> 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<LigatureTable>   ligTable(ligSetTable, success, ligTableOffset);