Date: Mon, 30 Jan 2012 15:16:26 GMT From: Pierre-Luc Drouin <pldrouin@pldrouin.net> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/164637: Problem with vsnprintf in libc.so when compiled with clang Message-ID: <201201301516.q0UFGQ1O075818@red.freebsd.org> Resent-Message-ID: <201201301520.q0UFK89A041949@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 164637
>Category: misc
>Synopsis: Problem with vsnprintf in libc.so when compiled with clang
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Jan 30 15:20:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Pierre-Luc Drouin
>Release: 9.0-STABLE
>Organization:
>Environment:
FreeBSD wdaemon 9.0-STABLE FreeBSD 9.0-STABLE #0: Mon Jan 23 16:02:56 EST 2012 /usr/obj/usr/src/sys/KERNEL i386
>Description:
When FreeBSD world (and kernel) is built using clang, the resulting code generated for vsnprintf in the library libc.so does not work properly, causing a segmentation fault. The problem was discovered when attempting to use java on FreeBSD.
>How-To-Repeat:
Compile and run the following C code on FreeBSD 9.0-STABLE built with clang:
#include <stdio.h>
#include <string.h>
int main(int nargrs, const char* args[])
{
const char* msg="Hello World!";
int length=strlen(msg);
printf("length is %i\n",length);
char string0[256];
char string[256];
memset(string0,1,256);
strcpy(string0,msg);
vsnprintf(string+1,length,"%s",string0);
printf("%s\n",string);
return 0;
}
Alternatively, try launching java or javac from jdk16, diablo-jdk16 or openjdk6
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201301516.q0UFGQ1O075818>
