Browse Source

Merge remote-tracking branch 'origin/maint-0.2.2'

Nick Mathewson 14 years ago
parent
commit
40288e1e66
2 changed files with 6 additions and 1 deletions
  1. 5 0
      changes/bug4059
  2. 1 1
      src/common/OpenBSD_malloc_Linux.c

+ 5 - 0
changes/bug4059

@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Change an integer overflow check in the OpenBSD_Malloc code so
+      that GCC is less likely to eliminate it as impossible. Patch
+      from Mansour Moufid. Fixes bug 4059.
+

+ 1 - 1
src/common/OpenBSD_malloc_Linux.c

@@ -1236,7 +1236,7 @@ imalloc(size_t size)
 		ptralloc = 1;
 		size = malloc_pagesize;
 	}
-	if ((size + malloc_pagesize) < size) {	/* Check for overflow */
+	if (size > SIZE_MAX - malloc_pagesize) { /* Check for overflow */
 		result = NULL;
 		errno = ENOMEM;
 	} else if (size <= malloc_maxsize)