There was an error while loading. Please reload this page.
2 parents a886142 + 4c8b2cd commit 87845bcCopy full SHA for 87845bc
3 files changed
Lib/test/test_mmap.py
@@ -720,6 +720,20 @@ def test_write_returning_the_number_of_bytes_written(self):
720
self.assertEqual(mm.write(b"yz"), 2)
721
self.assertEqual(mm.write(b"python"), 6)
722
723
+ @unittest.skipIf(os.name == 'nt', 'cannot resize anonymous mmaps on Windows')
724
+ def test_resize_past_pos(self):
725
+ m = mmap.mmap(-1, 8192)
726
+ self.addCleanup(m.close)
727
+ m.read(5000)
728
+ try:
729
+ m.resize(4096)
730
+ except SystemError:
731
+ self.skipTest("resizing not supported")
732
+ self.assertEqual(m.read(14), b'')
733
+ self.assertRaises(ValueError, m.read_byte)
734
+ self.assertRaises(ValueError, m.write_byte, 42)
735
+ self.assertRaises(ValueError, m.write, b'abc')
736
+
737
738
class LargeMmapTests(unittest.TestCase):
739
Misc/NEWS
@@ -404,6 +404,9 @@ Library
404
pickling and text representation purposes. Patch by Emanuel Barry and
405
Serhiy Storchaka.
406
407
+- Fix possible integer overflows and crashes in the mmap module with unusual
408
+ usage patterns.
409
410
- Issue #1703178: Fix the ability to pass the --link-objects option to the
411
distutils build_ext command.
412
0 commit comments