From d792da6ac6b8ae6e82aaaffb14d9854cd4ab0455 Mon Sep 17 00:00:00 2001 From: Petr Pchelko <pchelko@openjdk.org> Date: Wed, 19 Jun 2013 17:12:23 +0400 Subject: [PATCH] 8005661: [parfait] Possible buffer overrun in jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 8005695: [parfait] Format string argument mismatch in jdk/src/solaris/native/sun/xawt/XToolkit.c 8005752: [parfait] False positive function call mismatch at jdk/src/solaris/native/sun/xawt/XWindow.c Reviewed-by: art, serb --- .../solaris/native/sun/awt/awt_GraphicsEnv.c | 18 ++++++++++++------ .../solaris/native/sun/awt/awt_InputMethod.c | 6 +++--- jdk/src/solaris/native/sun/xawt/XToolkit.c | 9 +++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c index 0c62dca97a2..a6a986de72e 100644 --- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c +++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c @@ -1366,12 +1366,18 @@ Java_sun_awt_X11GraphicsConfig_pGetBounds(JNIEnv *env, jobject this, jint screen mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V"); if (mid != NULL) { if (usingXinerama) { - bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x, - fbrects[screen].y, - fbrects[screen].width, - fbrects[screen].height); - } - else { + if (0 <= screen && screen < awt_numScreens) { + bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x, + fbrects[screen].y, + fbrects[screen].width, + fbrects[screen].height); + } else { + jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); + if (exceptionClass != NULL) { + (*env)->ThrowNew(env, exceptionClass, "Illegal screen index"); + } + } + } else { XWindowAttributes xwa; memset(&xwa, 0, sizeof(xwa)); diff --git a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c index faa76460213..dd9fb952da7 100644 --- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c +++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c @@ -447,7 +447,7 @@ setXICWindowFocus(XIC ic, Window w) */ #define INITIAL_LOOKUP_BUF_SIZE 512 -Bool +Boolean awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp) { JNIEnv *env = GetJNIEnv(); @@ -457,8 +457,8 @@ awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp) int mblen; jstring javastr; XIC ic; - Bool result = True; - static Bool composing = False; + Boolean result = True; + static Boolean composing = False; /* printf("lookupString: entering...\n"); diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c index 6dfb80d368a..9abacadcb35 100644 --- a/jdk/src/solaris/native/sun/xawt/XToolkit.c +++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c @@ -685,8 +685,7 @@ performPoll(JNIEnv *env, jlong nextTaskTime) { if (result == 0) { /* poll() timed out -- update timeout value */ update_poll_timeout(TIMEOUT_TIMEDOUT); - PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n", - performPoll, curPollTimeout); + PRINT2("performPoll(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n", curPollTimeout); } if (pollFds[1].revents) { int count; @@ -695,14 +694,12 @@ performPoll(JNIEnv *env, jlong nextTaskTime) { do { count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE ); } while (count == AWT_POLL_BUFSIZE ); - PRINT2("%s(): data on the AWT pipe: curPollTimeout = %d \n", - performPoll, curPollTimeout); + PRINT2("performPoll(): data on the AWT pipe: curPollTimeout = %d \n", curPollTimeout); } if (pollFds[0].revents) { // Events in X pipe update_poll_timeout(TIMEOUT_EVENTS); - PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n", - performPoll, curPollTimeout); + PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout); } return;