diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-01-11 08:54:45 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-01-11 08:54:45 (GMT) |
commit | 3b4fff8079834433ba75ee0873c538410cd082c9 (patch) | |
tree | 7301da8a2959b7ca9d28db9beb5f9af55eef3f4e /Lib/test | |
parent | ae1df4112710fdfc7ffb6248b6a61b6b3cadd880 (diff) | |
download | cpython-3b4fff8079834433ba75ee0873c538410cd082c9.zip cpython-3b4fff8079834433ba75ee0873c538410cd082c9.tar.gz cpython-3b4fff8079834433ba75ee0873c538410cd082c9.tar.bz2 |
Fix SF bug #1402308, segfault when using mmap(-1, ...)
This didn't crash on Linux, but valgrind complained.
I'm not sure if this test is valid on Windows.
Will backport.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/output/test_mmap | 1 | ||||
-rw-r--r-- | Lib/test/test_mmap.py | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/output/test_mmap b/Lib/test/output/test_mmap index 02b24bc..1ce4943 100644 --- a/Lib/test/output/test_mmap +++ b/Lib/test/output/test_mmap @@ -31,6 +31,7 @@ test_mmap Modifying copy-on-write memory map. Ensuring copy-on-write maps cannot be resized. Ensuring invalid access parameter raises exception. + Try opening a bad file descriptor... Ensuring that passing 0 as map length sets map size to current file size. Ensuring that passing 0 as map length sets map size to current file size. Test passed diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 849f170..6930317 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -281,6 +281,14 @@ def test_both(): except OSError: pass + print ' Try opening a bad file descriptor...' + try: + mmap.mmap(-1, 4096) + except mmap.error: + pass + else: + verify(0, 'expected a mmap.error but did not get it') + # Do a tougher .find() test. SF bug 515943 pointed out that, in 2.2, # searching for data with embedded \0 bytes didn't work. f = open(TESTFN, 'w+') |