diff Objects/unicodeobject.c @ 39990:a9b1f404e88b 2.4

A review of overflow-detecting code in the 2.4 branch. * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c.
author Armin Rigo <arigo@tunes.org>
date Wed, 04 Oct 2006 10:13:32 +0000
parents 2632c9af64ab
children ab13576374b1
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Wed Oct 04 09:18:51 2006 +0000
+++ b/Objects/unicodeobject.c	Wed Oct 04 10:13:32 2006 +0000
@@ -2316,6 +2316,7 @@
     PyObject *exc = NULL;
 
     unimax = PyUnicode_GetMax();
+    /* XXX overflow detection missing */
     v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE);
     if (v == NULL)
 	goto onError;
@@ -2931,6 +2932,7 @@
 		    int needed = (targetsize - extrachars) + \
 			         (targetsize << 2);
 		    extrachars += needed;
+                    /* XXX overflow detection missing */
 		    if (_PyUnicode_Resize(&v,
 					 PyUnicode_GET_SIZE(v) + needed) < 0) {
 			Py_DECREF(x);