ports/114819: [patch] x11-toolkits/swt-devel crashes in realpath when invoke FileDialog

Dmitrij Tejblum dt at yandex.ru
Sun Jul 22 23:30:04 UTC 2007


>Number:         114819
>Category:       ports
>Synopsis:       [patch] x11-toolkits/swt-devel crashes in realpath when invoke FileDialog
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 22 23:30:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Dmitrij Tejblum
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
>Description:
When an java application using SWT toolkit (from the swt-devel port) open 
FileDialog, JVM crashes in the realpath() function. It's because SWT rely on 
a linux extension not present in FreeBSD.

>How-To-Repeat:

>Fix:
Put following patch to the files directory (and bump PORTEPOCH):

--- ./os.c	2007-07-22 11:53:22.000000000 +0400
+++ ./os.c	2007-07-22 11:57:56.000000000 +0400
@@ -17397,11 +17397,16 @@
 	jint rc = 0;
 	OS_NATIVE_ENTER(env, that, realpath_FUNC);
 	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
-	if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+	if (arg1) {
+	    if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+	} else
+	    lparg1 = malloc(PATH_MAX);
 	rc = (jint)realpath((const char *)lparg0, (char *)lparg1);
 fail:
 	if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
 	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+	if (!arg1 && lparg1 && rc == 0)
+	    free(lparg1);
 	OS_NATIVE_EXIT(env, that, realpath_FUNC);
 	return rc;
 }

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list