bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bug in wide string formatting


From: Aristarkh A Zagorodnikov
Subject: Possible bug in wide string formatting
Date: Thu, 14 Aug 2003 11:36:06 +0400

                Hello!

        Following is the demonstration code for a possible bug in wide
string formatting code regarding "%p" format and zero pointers:

address@hidden:~/D/Projects/QSX/QSX/Source$ cat bug.c
#include <stdio.h>

int main(int argc, char* argv[])
{
        char buffer[1000];
        sprintf(buffer, "%p", 0);
        wchar_t wbuffer[1000];
        swprintf(wbuffer, 1000, L"%p", 0);
        printf("%hs\n%ls\n", buffer, wbuffer);
        return 0;
}
address@hidden:~/D/Projects/QSX/QSX/Source$ gcc bug.c -o bug
address@hidden:~/D/Projects/QSX/QSX/Source$ ./bug
(nil)
(

        Notice that the two last lines should be the same "(nil)" and
they are obviously not.

        The system specs are as follows:
glibc: 2.3.2 (debian version 2.3.2-2)

gcc:
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc
i386-linux
Thread model: posix
gcc version 3.3.1 (Debian)

Kernel: Linux xm-debian 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002
i686 unknown

Aristarkh A Zagorodnikov
X-Infinity Software





reply via email to

[Prev in Thread] Current Thread [Next in Thread]