Issue #7019: An attempt to unmarshal bad long data could produce

unnormalized PyLong objects; make it raise ValueError instead.
This commit is contained in:
Mark Dickinson 2009-10-03 08:15:49 +00:00
parent 7664bfe4e2
commit c3a12775e2
3 changed files with 10 additions and 1 deletions

View file

@ -262,6 +262,11 @@ class BugsTestCase(unittest.TestCase):
testString = 'abc' * size
marshal.dumps(testString)
def test_invalid_longs(self):
# Issue #7019: marshal.loads shouldn't produce unnormalized PyLongs
invalid_string = 'l\x02\x00\x00\x00\x00\x00\x00\x00'
self.assertRaises(ValueError, marshal.loads, invalid_string)
def test_main():
test_support.run_unittest(IntTestCase,