]> granicus.if.org Git - python/commitdiff
dump(): Added asserts that self->proto is sane.
authorTim Peters <tim.peters@gmail.com>
Sun, 2 Feb 2003 16:16:30 +0000 (16:16 +0000)
committerTim Peters <tim.peters@gmail.com>
Sun, 2 Feb 2003 16:16:30 +0000 (16:16 +0000)
Modules/cPickle.c

index 17ccb45893854473ffee1acbc2a11b35192f0daf..31a59f2a0fb683b1483e5c1cafc5bae4ced2db93 100644 (file)
@@ -2217,7 +2217,8 @@ dump(Picklerobject *self, PyObject *args)
                char bytes[2];
 
                bytes[0] = PROTO;
-               bytes[1] = self->proto;
+               assert(self->proto >= 0 && self->proto < 256);
+               bytes[1] = (char)self->proto;
                if (self->write_func(self, bytes, 2) < 0)
                        return -1;
        }