changeset 6704:447531e39bad

8020293: JVM crash Reviewed-by: prr, jgodinez
author jchen
date Mon, 22 Jul 2013 14:06:39 -0700
parents 0f7896059207
children 01b9e1ec3b9b
files src/share/classes/sun/font/GlyphLayout.java src/share/native/sun/font/layout/SunLayoutEngine.cpp
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/font/GlyphLayout.java	Fri Jul 19 16:29:26 2013 +0200
+++ b/src/share/classes/sun/font/GlyphLayout.java	Mon Jul 22 14:06:39 2013 -0700
@@ -468,9 +468,10 @@
                         _gvdata.grow();
                     }
                 }
-                if (_gvdata._count < 0) {
-                    break;
-                }
+            }
+            // Break out of the outer for loop if layout fails.
+            if (_gvdata._count < 0) {
+                break;
             }
         }
 
--- a/src/share/native/sun/font/layout/SunLayoutEngine.cpp	Fri Jul 19 16:29:26 2013 +0200
+++ b/src/share/native/sun/font/layout/SunLayoutEngine.cpp	Mon Jul 22 14:06:39 2013 -0700
@@ -104,6 +104,10 @@
 
 int putGV(JNIEnv* env, jint gmask, jint baseIndex, jobject gvdata, const LayoutEngine* engine, int glyphCount) {
     int count = env->GetIntField(gvdata, gvdCountFID);
+    if (count < 0) {
+      JNU_ThrowInternalError(env, "count negative");
+      return 0;
+    }
 
     jarray glyphArray = (jarray)env->GetObjectField(gvdata, gvdGlyphsFID);
     if (IS_NULL(glyphArray)) {