--- a/jdk/src/share/native/sun/java2d/loops/FillPath.c Thu Oct 03 11:28:37 2013 +0400
+++ b/jdk/src/share/native/sun/java2d/loops/FillPath.c Thu Oct 03 13:16:31 2013 -0700
@@ -64,7 +64,8 @@
CompositeInfo compInfo;
jint ret;
NativePrimitive *pPrim = GetNativePrim(env, self);
- jint stroke = (*env)->GetIntField(env, sg2d, sg2dStrokeHintID);
+ jint stroke;
+ jboolean throwExc = JNI_FALSE;
if (pPrim == NULL) {
return;
@@ -73,6 +74,8 @@
GrPrim_Sg2dGetCompInfo(env, sg2d, pPrim, &compInfo);
}
+ stroke = (*env)->GetIntField(env, sg2d, sg2dStrokeHintID);
+
sdOps = SurfaceData_GetOps(env, sData);
if (sdOps == 0) {
return;
@@ -102,6 +105,10 @@
maxCoords = (*env)->GetArrayLength(env, coordsArray);
coords = (jfloat*)(*env)->GetPrimitiveArrayCritical(
env, coordsArray, NULL);
+ if (coords == NULL) {
+ SurfaceData_InvokeUnlock(env, sdOps, &rasInfo);
+ return;
+ }
if (ret == SD_SLOWLOCK) {
GrPrim_RefineBounds(&rasInfo.bounds, transX, transY,
@@ -146,24 +153,31 @@
drawHandler.yMax = rasInfo.bounds.y2;
drawHandler.pData = &dHData;
- if (!doFillPath(&drawHandler,
- transX, transY, coords,
- maxCoords, types, numTypes,
- (stroke == sunHints_INTVAL_STROKE_PURE)?
- PH_STROKE_PURE : PH_STROKE_DEFAULT,
- fillRule))
- {
- JNU_ThrowArrayIndexOutOfBoundsException(env,
- "coords array");
+ if (types != NULL) {
+ if (!doFillPath(&drawHandler,
+ transX, transY, coords,
+ maxCoords, types, numTypes,
+ (stroke == sunHints_INTVAL_STROKE_PURE)?
+ PH_STROKE_PURE : PH_STROKE_DEFAULT,
+ fillRule))
+ {
+ throwExc = JNI_TRUE;
+ }
+
+ (*env)->ReleasePrimitiveArrayCritical(env, typesArray, types,
+ JNI_ABORT);
}
-
- (*env)->ReleasePrimitiveArrayCritical(env, typesArray, types,
- JNI_ABORT);
}
}
SurfaceData_InvokeRelease(env, sdOps, &rasInfo);
}
(*env)->ReleasePrimitiveArrayCritical(env, coordsArray, coords,
JNI_ABORT);
+
+ if (throwExc) {
+ JNU_ThrowArrayIndexOutOfBoundsException(env,
+ "coords array");
+ }
+
SurfaceData_InvokeUnlock(env, sdOps, &rasInfo);
}