changeset 8423:490c67c5d9a2

8020293: JVM crash Reviewed-by: prr, jgodinez
author jchen
date Wed, 24 Jul 2013 12:03:57 -0700
parents 5bdc55e87cae
children bcce47d9d8da 1a1e42c8e988
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	Wed Jul 17 18:46:00 2013 +0800
+++ b/src/share/classes/sun/font/GlyphLayout.java	Wed Jul 24 12:03:57 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	Wed Jul 17 18:46:00 2013 +0800
+++ b/src/share/native/sun/font/layout/SunLayoutEngine.cpp	Wed Jul 24 12:03:57 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)) {