Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7adfad85
Commit
7adfad85
authored
Feb 15, 2008
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
parent
2f0da53d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
0 deletions
+13
-0
Lib/test/test_mmap.py
Lib/test/test_mmap.py
+7
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/mmapmodule.c
Modules/mmapmodule.c
+4
-0
No files found.
Lib/test/test_mmap.py
View file @
7adfad85
...
@@ -426,6 +426,13 @@ class MmapTests(unittest.TestCase):
...
@@ -426,6 +426,13 @@ class MmapTests(unittest.TestCase):
return
mmap
.
mmap
.
__new__
(
klass
,
-
1
,
*
args
,
**
kwargs
)
return
mmap
.
mmap
.
__new__
(
klass
,
-
1
,
*
args
,
**
kwargs
)
anon_mmap
(
PAGESIZE
)
anon_mmap
(
PAGESIZE
)
def
test_prot_readonly
(
self
):
mapsize
=
10
open
(
TESTFN
,
"wb"
).
write
(
"a"
*
mapsize
)
f
=
open
(
TESTFN
,
"rb"
)
m
=
mmap
.
mmap
(
f
.
fileno
(),
mapsize
,
prot
=
mmap
.
PROT_READ
)
self
.
assertRaises
(
TypeError
,
m
.
write
,
"foo"
)
def
test_main
():
def
test_main
():
run_unittest
(
MmapTests
)
run_unittest
(
MmapTests
)
...
...
Misc/NEWS
View file @
7adfad85
...
@@ -1142,6 +1142,8 @@ Library
...
@@ -1142,6 +1142,8 @@ Library
Extension Modules
Extension Modules
-----------------
-----------------
- Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
- #2063: correct order of utime and stime in os.times() result on Windows.
- #2063: correct order of utime and stime in os.times() result on Windows.
- Patch #1736: Fix file name handling of _msi.FCICreate.
- Patch #1736: Fix file name handling of _msi.FCICreate.
...
...
Modules/mmapmodule.c
View file @
7adfad85
...
@@ -1122,6 +1122,10 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
...
@@ -1122,6 +1122,10 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
"mmap invalid access parameter."
);
"mmap invalid access parameter."
);
}
}
if
(
prot
==
PROT_READ
)
{
access
=
ACCESS_READ
;
}
#ifdef HAVE_FSTAT
#ifdef HAVE_FSTAT
# ifdef __VMS
# ifdef __VMS
/* on OpenVMS we must ensure that all bytes are written to the file */
/* on OpenVMS we must ensure that all bytes are written to the file */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment