[poppler] Poppler provided printf() functions on Windows not language compliant

William Bader williambader at hotmail.com
Fri Mar 4 23:11:49 UTC 2016

> To: poppler at lists.freedesktop.org
> Date: Fri, 4 Mar 2016 13:49:38 -0800
> From: mathog at caltech.edu
> Subject: [poppler] Poppler provided printf() functions on Windows not	language compliant
> In tracking down a bug in Inkscape here:
>    https://bugs.launchpad.net/inkscape/+bug/1538361
> it was discovered that the version of Poppler in devlibs61 appears to 
> provide its own printf() functions, which replace the usual ones, and 
> that these mishandle this case:
>     double val=0.0;
>     printf("%lf\n",val);

poppler has classes that have member functions called printf() but I think that poppler does not redefine the printf() in the global name space. (I'm not a poppler developer. Someone will probably correct me later if I am mistaken.)
The stack traces in https://bugs.launchpad.net/inkscape/+bug/1538361 do not show any symbol names.
Can you link Inkscape with a build of poppler that was compiled with -g to identify the location of the replacement printf()?
Inside a git clone of poppler,
git grep printf | grep '\.\.\.'
returns the lines below. The only definitions of printf() are FileOutStream::printf() and QIODeviceOutStream::printf(), neither of which should affect Inkscape's calls to the stdio printf() in the global name space.
NEWS:         * Use error() instead of fprintf(stderr, ...) in Annot::layoutText
glib/demo/find.c:       str = g_strdup_printf ("Searching ... (%d%%)",
poppler/Stream.cc:void FileOutStream::printf(const char *format, ...)
poppler/Stream.h:  virtual void printf (const char *format, ...) GCC_PRINTF_FORMAT(2,3) = 0;
poppler/Stream.h:  virtual void printf (const char *format, ...);
qt4/src/poppler-qiodeviceoutstream-private.h:    virtual void printf(const char *format, ...);
qt4/src/poppler-qiodeviceoutstream.cc:void QIODeviceOutStream::printf(const char *format, ...)
qt5/src/poppler-qiodeviceoutstream-private.h:    virtual void printf(const char *format, ...);
qt5/src/poppler-qiodeviceoutstream.cc:void QIODeviceOutStream::printf(const char *format, ...)

You noticed that "nm" and "strings" both show "printf" in libpoppler, but poppler calls printf() for some error messages, so you could have found a call to printf() instead of a redefinition of printf(). Can you repeat the scan using a tool that tells whether the symbol table entry is a reference or a declaration?
For example, with a simple hello world program in C on Linux,
$ cc -c hello.c
$ nm hello.o
0000000000000000 T main <- T means a declaration (T = location is in the text (code) section)
                 U puts <- U means a reference (U = undefined)
If you can demonstrate conclusively that it is a bug in poppler, can you enter a bug report at bugs.freedesktop.org ?
Regards, William
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20160304/02729253/attachment.html>

More information about the poppler mailing list