After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332841 - Segmentation Fault when %llu is passed to vasnprintf and HAVE_SNPRINTF is not defined
Segmentation Fault when %llu is passed to vasnprintf and HAVE_SNPRINTF is not...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.8.x
Other Linux
: Normal critical
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2006-02-28 14:19 UTC by Michael McDonald
Modified: 2006-04-05 15:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix that adds support for the call to print_long_long if HAVE_SNPRINTF is not defined (550 bytes, patch)
2006-02-28 14:23 UTC, Michael McDonald
none Details | Review

Description Michael McDonald 2006-02-28 14:19:41 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
Comment 1 Michael McDonald 2006-02-28 14:23:08 UTC
Created attachment 60318 [details] [review]
Fix that adds support for the call to print_long_long if HAVE_SNPRINTF is not defined
Comment 2 Matthias Clasen 2006-04-05 15:07:56 UTC
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)