# HG changeset patch # User jchen # Date 1374692637 25200 # Node ID 7d54086945ddb278a95c9cb07d7d2d36da42bd2b # Parent 29e3da385ed239e20bdf2932a3b82ec0ace7e2e8 8020293: JVM crash Reviewed-by: prr, jgodinez diff -r 29e3da385ed2 -r 7d54086945dd jdk/src/share/classes/sun/font/GlyphLayout.java --- a/jdk/src/share/classes/sun/font/GlyphLayout.java Wed Jul 17 18:46:00 2013 +0800 +++ b/jdk/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; } } diff -r 29e3da385ed2 -r 7d54086945dd jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp --- a/jdk/src/share/native/sun/font/layout/SunLayoutEngine.cpp Wed Jul 17 18:46:00 2013 +0800 +++ b/jdk/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)) {