[Python-checkins] python/dist/src/Lib/test test_marshal.py, 1.11, 1.12

mwh@users.sourceforge.net mwh at users.sourceforge.net
Mon Jun 13 20:28:48 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13610/Lib/test

Modified Files:
	test_marshal.py 
Log Message:
Fix bug

[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff

which I'd assigned to Martin, but actually turned out to be easy to fix.

Also, a test.



Index: test_marshal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test_marshal.py	4 Jun 2005 12:55:32 -0000	1.11
+++ test_marshal.py	13 Jun 2005 18:28:42 -0000	1.12
@@ -211,6 +211,15 @@
         self.assertEquals(marshal.loads(marshal.dumps(5, 0)), 5)
         self.assertEquals(marshal.loads(marshal.dumps(5, 1)), 5)
 
+    def test_fuzz(self):
+        # simple test that it's at least not *totally* trivial to
+        # crash from bad marshal data
+        for c in [chr(i) for i in range(256)]:
+            try:
+                marshal.loads(c)
+            except Exception:
+                pass
+
 def test_main():
     test_support.run_unittest(IntTestCase,
                               FloatTestCase,



More information about the Python-checkins mailing list