GNOME Bugzilla – Bug 332841
Segmentation Fault when %llu is passed to vasnprintf and HAVE_SNPRINTF is not defined
Last modified: 2006-04-05 15:07:56 UTC
I'm receiving a segmentation fault when I cross-compile glib for the PXA-270 (ARM based). The segmentation fault occurs when I run gst-inspect, part of gstreamer. I tracked the bug down to vasnprintf, in the file /glib/gnulib/vasnprintf.c, being passed '%llu' to format an unsigned long long variable. In the function the call to print_long_long is handled when HAVE_SNPRINTF is defined, but not when it is not defined. I have included a patch with adds support in HAVE_SNPRINTF is not defined. Also I believe that the function print_long_long in vasnprintf.c should either return if it is passed len=0 or assert that len!=0. I didn't include this in the patch though. I didn't see anywhere to upload the patch, so I just attached it to the bottom of the message. Thanks, Michael McDonald --- ./glib-2.8.6/glib/gnulib/vasnprintf.c 2004-05-14 00:58:19.000000000 -0400 +++ ./glib-2.8.6.fix/glib/gnulib/vasnprintf.c 2006-02-28 08:16:02.000000000 -0500 @@ -853,11 +853,19 @@ } } +#if HAVE_SNPRINTF count = print_long_long (result + length, maxlen, width, precision, dp->flags, dp->conversion, arg); +#else + count = print_long_long (tmp, tmp_length, + width, precision, + dp->flags, + dp->conversion, + arg); +#endif } break; #else
Created attachment 60318 [details] [review] Fix that adds support for the call to print_long_long if HAVE_SNPRINTF is not defined
Thanks 2006-04-05 Matthias Clasen <mclasen@redhat.com> * glib/gnulib/vasnprintf.c (vasnprintf): Make long long printing work if snprintf is not available. (#332841, Michael McDonald)