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
cd04db03
Commit
cd04db03
authored
Oct 05, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmap: do all internal arithmetic with Py_ssize_t while being very careful about overflow
parent
92e7c7f9
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
109 deletions
+92
-109
Lib/test/test_mmap.py
Lib/test/test_mmap.py
+11
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/mmapmodule.c
Modules/mmapmodule.c
+78
-109
No files found.
Lib/test/test_mmap.py
View file @
cd04db03
...
...
@@ -713,6 +713,17 @@ class MmapTests(unittest.TestCase):
gc_collect
()
self
.
assertIs
(
wr
(),
None
)
def
test_resize_past_pos
(
self
):
m
=
mmap
.
mmap
(
-
1
,
8192
)
self
.
addCleanup
(
m
.
close
)
m
.
read
(
5000
)
m
.
resize
(
4096
)
self
.
assertEqual
(
m
.
read
(
14
),
b''
)
self
.
assertRaises
(
ValueError
,
m
.
read_byte
,)
self
.
assertRaises
(
ValueError
,
m
.
write_byte
,
42
)
self
.
assertRaises
(
ValueError
,
m
.
write
,
b'abc'
)
class
LargeMmapTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
Misc/NEWS
View file @
cd04db03
...
...
@@ -94,6 +94,9 @@ Library
- Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data. Based on patch by John Leitch.
- Fix possible integer overflows and crashes in the mmap module with unusual
usage patterns.
- Issue #1703178: Fix the ability to pass the --link-objects option to the
distutils build_ext command.
...
...
Modules/mmapmodule.c
View file @
cd04db03
This diff is collapsed.
Click to expand it.
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