diff src/share/native/sun/font/DrawGlyphList.c @ 9879:3540bddf866b

8043508: JVM core dumps with very long text in tooltip Reviewed-by: bae, jgodinez
author prr
date Thu, 31 Jul 2014 10:47:51 -0700
parents 1a3de3cdc684
children eeac0c758228
line wrap: on
line diff
--- a/src/share/native/sun/font/DrawGlyphList.c	Wed Jul 30 00:00:22 2014 +0400
+++ b/src/share/native/sun/font/DrawGlyphList.c	Thu Jul 31 10:47:51 2014 -0700
@@ -52,7 +52,8 @@
 
 GlyphBlitVector* setupBlitVector(JNIEnv *env, jobject glyphlist) {
 
-    int g, bytesNeeded;
+    int g;
+    size_t bytesNeeded;
     jlong *imagePtrs;
     jfloat* positions = NULL;
     GlyphInfo *ginfo;
@@ -71,6 +72,9 @@
 
     bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
     gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+    if (gbv == NULL) {
+        return NULL;
+    }
     gbv->numGlyphs = len;
     gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));
 
@@ -479,7 +483,8 @@
  */
 GlyphBlitVector* setupLCDBlitVector(JNIEnv *env, jobject glyphlist) {
 
-    int g, bytesNeeded;
+    int g;
+    size_t bytesNeeded;
     jlong *imagePtrs;
     jfloat* positions = NULL;
     GlyphInfo *ginfo;
@@ -500,6 +505,9 @@
 
     bytesNeeded = sizeof(GlyphBlitVector)+sizeof(ImageRef)*len;
     gbv = (GlyphBlitVector*)malloc(bytesNeeded);
+    if (gbv == NULL) {
+        return NULL;
+    }
     gbv->numGlyphs = len;
     gbv->glyphs = (ImageRef*)((unsigned char*)gbv+sizeof(GlyphBlitVector));