Fix crash when printing large 64-bit values on Win32 using the %I64x glib-2-12-branchpoint
authorTor Lillqvist <tml@novell.com>
Sun, 20 Aug 2006 13:39:48 +0000 (13:39 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 20 Aug 2006 13:39:48 +0000 (13:39 +0000)
2006-08-20  Tor Lillqvist  <tml@novell.com>

* glib/gnulib/vasnprintf.c (vasnprintf): Fix crash when printing
large 64-bit values on Win32 using the %I64x format. (#351034,
Neil Piercy)

ChangeLog
ChangeLog.pre-2-12
glib/gnulib/vasnprintf.c

index cdd11954c1d7a5a33da42a2b3a3ae97583ec539d..4259a134dadf47d7b879dba449704ecabd78ec11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-20  Tor Lillqvist  <tml@novell.com>
+
+       * glib/gnulib/vasnprintf.c (vasnprintf): Fix crash when printing
+       large 64-bit values on Win32 using the %I64x format. (#351034,
+       Neil Piercy)
+
 Wed Aug 16 13:59:07 2006  Tim Janik  <timj@gtk.org>
 
        * tests/gobject/Makefile.am:
index cdd11954c1d7a5a33da42a2b3a3ae97583ec539d..4259a134dadf47d7b879dba449704ecabd78ec11 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-20  Tor Lillqvist  <tml@novell.com>
+
+       * glib/gnulib/vasnprintf.c (vasnprintf): Fix crash when printing
+       large 64-bit values on Win32 using the %I64x format. (#351034,
+       Neil Piercy)
+
 Wed Aug 16 13:59:07 2006  Tim Janik  <timj@gtk.org>
 
        * tests/gobject/Makefile.am:
index 1b468001d584ec3cc29e90b07567a6c4731f72df..e279fc09bdf454becd886edd899312e0622aa7e1 100644 (file)
@@ -479,6 +479,16 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
                          + 1 /* turn floor into ceil */
                          + 2; /* account for leading sign or alternate form */
                      else
+# endif
+# ifdef HAVE_INT64_AND_I64
+                     if (type == TYPE_INT64 || type == TYPE_UINT64)
+                       tmp_length =
+                         (unsigned int) (sizeof (unsigned __int64) * CHAR_BIT
+                                         * 0.25 /* binary -> hexadecimal */
+                                         )
+                         + 1 /* turn floor into ceil */
+                         + 2; /* account for leading sign or alternate form */
+                     else
 # endif
                      if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
                        tmp_length =