changeset 11580:15ac2980d572

8145551: Test failed with Crash for Improved font lookups Reviewed-by: prr, vadim
author aivanov
date Tue, 22 Dec 2015 09:58:49 +0300
parents eb787ca49081
children 594e8dca337c
files src/share/native/sun/font/layout/Features.cpp src/share/native/sun/font/layout/Lookups.cpp
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/font/layout/Features.cpp	Mon Dec 21 13:44:20 2015 -0800
+++ b/src/share/native/sun/font/layout/Features.cpp	Tue Dec 22 09:58:49 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/src/share/native/sun/font/layout/Lookups.cpp	Mon Dec 21 13:44:20 2015 -0800
+++ b/src/share/native/sun/font/layout/Lookups.cpp	Tue Dec 22 09:58:49 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)));