summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2006-08-20 13:39:48 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-08-20 13:39:48 +0000
commit0d37c815d90cf9a41be95f7fa9a91773e9770ea6 (patch)
treef51ac072a2040da94c51af73515c82090c1873bf
parent1b60e2744ae89cf655b9f0fc75cdc00337c441d7 (diff)
Fix crash when printing large 64-bit values on Win32 using the %I64xglib-2-12-branchpoint
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)
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-126
-rw-r--r--glib/gnulib/vasnprintf.c10
3 files changed, 22 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cdd11954c..4259a134d 100644
--- 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:
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index cdd11954c..4259a134d 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -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:
diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c
index 1b468001d..e279fc09b 100644
--- a/glib/gnulib/vasnprintf.c
+++ b/glib/gnulib/vasnprintf.c
@@ -480,6 +480,16 @@ vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args)
+ 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 =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT