8145551: Test failed with Crash for Improved font lookups
authoraivanov
Tue, 22 Dec 2015 09:50:09 +0300
changeset 35299 d5737dedc6df
parent 35298 9f93cbce8c44
child 35300 30eaec7fded0
8145551: Test failed with Crash for Improved font lookups Reviewed-by: prr, vadim
jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp
jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp	Tue Dec 15 12:59:00 2015 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Features.cpp	Tue Dec 22 09:50:09 2015 +0300
@@ -43,9 +43,10 @@
     LEReferenceToArrayOf<FeatureRecord>
         featureRecordArrayRef(base, success, featureRecordArray, SWAPW(featureCount));
 
-  if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
-    return LEReferenceTo<FeatureTable>();
-  }
+    if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
+        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
+        return LEReferenceTo<FeatureTable>();
+    }
 
     Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset;
 
--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp	Tue Dec 15 12:59:00 2015 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/Lookups.cpp	Tue Dec 22 09:50:09 2015 +0300
@@ -42,6 +42,7 @@
   LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
 
   if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) {
+    success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
     return LEReferenceTo<LookupTable>();
   } else {
     return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success)));
@@ -53,6 +54,7 @@
   LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
 
   if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) {
+    success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
     return LEReferenceTo<LookupSubtable>();
   } else {
     return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success)));