Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2007 02:55:23 +0400 (MSD)
From:      Dmitrij Tejblum <dt@yandex.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/114819: [patch] x11-toolkits/swt-devel crashes in realpath when invoke FileDialog
Message-ID:  <200707222255.l6MMtNOm028791@tejblum.pp.ru>
Resent-Message-ID: <200707222330.l6MNU31d084952@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707222255.l6MMtNOm028791>