]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport theller's checkin of
authorMichael W. Hudson <mwh@python.net>
Tue, 24 Sep 2002 11:55:54 +0000 (11:55 +0000)
committerMichael W. Hudson <mwh@python.net>
Tue, 24 Sep 2002 11:55:54 +0000 (11:55 +0000)
    revision 1.73 of marshal.c

Fix SF 588452: debug build crashes on marshal.dumps([128] * 1000).
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.

Python/marshal.c

index 0d21e847b770b9227a1a4dc77f497d85d8bd2eb1..6ba20c9698a6cab39fa1e9ac2e19f97eaa301fbc 100644 (file)
@@ -82,17 +82,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