8042855: [parfait] Potential null pointer dereference in IndicLayoutEngine.cpp
authorprr
Thu, 22 May 2014 13:54:08 -0700
changeset 25101 2b07b28079a1
parent 25100 d527cc827d7d
child 25102 669df2eb0922
8042855: [parfait] Potential null pointer dereference in IndicLayoutEngine.cpp Reviewed-by: bae, srl
jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp
jdk/src/share/native/sun/font/layout/IndicReordering.cpp
jdk/src/share/native/sun/font/layout/IndicReordering.h
--- a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp	Thu May 22 21:05:30 2014 +0400
+++ b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp	Thu May 22 13:54:08 2014 -0700
@@ -151,7 +151,7 @@
     le_int32 outCharCount;
     if (fVersion2) {
         _LETRACE("v2process");
-        outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage);
+        outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage, success);
     } else {
         _LETRACE("reorder");
         outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups, success);
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp	Thu May 22 21:05:30 2014 +0400
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp	Thu May 22 13:54:08 2014 -0700
@@ -1096,9 +1096,13 @@
 
 
 le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
-                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+                                  LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success)
 {
     const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
+    if (classTable == NULL) {
+        success = LE_MEMORY_ALLOCATION_ERROR;
+        return 0;
+    }
 
     DynamicProperties dynProps[INDIC_BLOCK_SIZE];
     IndicReordering::getDynamicProperties(dynProps,classTable);
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.h	Thu May 22 21:05:30 2014 +0400
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.h	Thu May 22 13:54:08 2014 -0700
@@ -181,7 +181,7 @@
     static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success);
 
     static le_int32 v2process(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
-        LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+        LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success);
 
     static const FeatureMap *getFeatureMap(le_int32 &count);