Author: Armin Rigo <[email protected]>
Branch: inline-dict-ops
Changeset: r48312:ea30df33f75c
Date: 2011-10-21 16:23 +0200
http://bitbucket.org/pypy/pypy/changeset/ea30df33f75c/
Log: Add correct overflow checking for Boehm's malloc
diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -105,7 +105,10 @@
self.funcptr_for_new = malloc_fn_ptr
def malloc_array(basesize, itemsize, ofs_length, num_elem):
- size = basesize + itemsize * num_elem
+ try:
+ size = ovfcheck(basesize + ovfcheck(itemsize * num_elem))
+ except OverflowError:
+ return lltype.nullptr(llmemory.GCREF.TO)
res = self.funcptr_for_new(size)
if not res:
return res
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit