[pypy-svn] r18669 - in pypy/dist/pypy: interpreter translator/c/src

arigo at codespeak.net arigo at codespeak.net
Sun Oct 16 10:56:04 CEST 2005


Author: arigo
Date: Sun Oct 16 10:56:03 2005
New Revision: 18669

Modified:
   pypy/dist/pypy/interpreter/argument.py
   pypy/dist/pypy/translator/c/src/mem.h
Log:
* avoid a slice where stop < start (crashes after translation).
* make sure we catch mallocs of negative size.


Modified: pypy/dist/pypy/interpreter/argument.py
==============================================================================
--- pypy/dist/pypy/interpreter/argument.py	(original)
+++ pypy/dist/pypy/interpreter/argument.py	Sun Oct 16 10:56:03 2005
@@ -177,7 +177,7 @@
         # note that for this purpose we ignore the first blind_arguments,
         # which were put into place by prepend().  This way, keywords do
         # not conflict with the hidden extra argument bound by methods.
-        if kwds_w:
+        if kwds_w and input_argcount > self.blind_arguments:
             for name in argnames[self.blind_arguments:input_argcount]:
                 if name in kwds_w:
                     raise ArgErrMultipleValues(name)

Modified: pypy/dist/pypy/translator/c/src/mem.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/mem.h	(original)
+++ pypy/dist/pypy/translator/c/src/mem.h	Sun Oct 16 10:56:03 2005
@@ -9,7 +9,7 @@
 #define MAXIMUM_MALLOCABLE_SIZE   (LONG_MAX-4096)
 
 #define OP_MAX_VARSIZE(numitems, itemtype, err)  {			\
-    if ((numitems) > (MAXIMUM_MALLOCABLE_SIZE / sizeof(itemtype)))	\
+    if (((unsigned)(numitems)) > (MAXIMUM_MALLOCABLE_SIZE / sizeof(itemtype)))\
         FAIL_EXCEPTION(err, PyExc_MemoryError, "addr space overflow");	\
   } 
 



More information about the Pypy-commit mailing list