[glib] Bug 624968 - div by zero in g_malloc_n family



commit 8f80ff02af2fabd22d5aac1d1b853d1ac7865e85
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Jul 21 16:08:19 2010 -0400

    Bug 624968  - div by zero in g_malloc_n family

 glib/gmem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmem.c b/glib/gmem.c
index 1e92ffd..2c9b74a 100644
--- a/glib/gmem.c
+++ b/glib/gmem.c
@@ -263,7 +263,7 @@ g_try_realloc (gpointer mem,
 }
 
 
-#define SIZE_OVERFLOWS(a,b) (G_UNLIKELY ((a) > G_MAXSIZE / (b)))
+#define SIZE_OVERFLOWS(a,b) (G_UNLIKELY ((b) > 0 && (a) > G_MAXSIZE / (b)))
 
 gpointer
 g_malloc_n (gsize n_blocks,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]