]> granicus.if.org Git - python/commitdiff
Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).
authorThomas Heller <theller@ctypes.org>
Tue, 30 Jul 2002 11:40:57 +0000 (11:40 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 30 Jul 2002 11:40:57 +0000 (11:40 +0000)
See there for a description.

Added test case.

Bugfix candidate for 2.2.x, not sure about previous versions:
probably low priority, because virtually no one runs debug builds.

Lib/test/test_marshal.py
Python/marshal.c

index 53772246eb8177981e9089bd7038670725fd0a29..9237af0b63883e5efa4e17cd9a9438e62e3437b9 100644 (file)
@@ -39,3 +39,6 @@ for base in maxint64, minint64, -maxint64, -(minint64 >> 1):
             base = 0
         else:
             base >>= 1
+
+# Simple-minded check for SF 588452: Debug build crashes
+marshal.dumps([128] * 1000)
index 0df46cf1636a6b93378cdc0ef7ba5bd6a3c83f1d..c00586dc9325130c39ae39b68cb06817e4b01593 100644 (file)
@@ -84,17 +84,17 @@ w_string(char *s, int n, WFILE *p)
 static void
 w_short(int x, WFILE *p)
 {
-       w_byte( x      & 0xff, p);
-       w_byte((x>> 8) & 0xff, p);
+       w_byte((char)( x      & 0xff), p);
+       w_byte((char)((x>> 8) & 0xff), p);
 }
 
 static void
 w_long(long x, WFILE *p)
 {
-       w_byte((int)( x      & 0xff), p);
-       w_byte((int)((x>> 8) & 0xff), p);
-       w_byte((int)((x>>16) & 0xff), p);
-       w_byte((int)((x>>24) & 0xff), p);
+       w_byte((char)( x      & 0xff), p);
+       w_byte((char)((x>> 8) & 0xff), p);
+       w_byte((char)((x>>16) & 0xff), p);
+       w_byte((char)((x>>24) & 0xff), p);
 }
 
 #if SIZEOF_LONG > 4