JBR-6884 SIGSEGV in Java_sun_java2d_wl_WLSMSurfaceData_pixelsAt

This commit is contained in:
Maxim Kartashev
2024-03-25 11:36:37 +04:00
committed by Maxim Kartashёv
parent a946a753c2
commit 75a7617dd3

View File

@@ -176,6 +176,11 @@ Java_sun_java2d_wl_WLSMSurfaceData_pixelsAt(JNIEnv *env, jobject wsd, jint x, ji
return NULL;
}
if (rasInfo.bounds.x2 - rasInfo.bounds.x1 < width || rasInfo.bounds.y2 - rasInfo.bounds.y1 < height) {
JNU_ThrowByName(env, "java/lang/ArrayIndexOutOfBoundsException", "Surface too small");
return NULL;
}
jintArray arrayObj = NULL;
ops->GetRasInfo(env, ops, &rasInfo);
if (rasInfo.rasBase && rasInfo.pixelStride == sizeof(jint)) {