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
3c87a667
Commit
3c87a667
authored
Sep 08, 2019
by
HongWeipeng
Committed by
Serhiy Storchaka
Sep 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
This is a complement to PR 13375.
parent
32a960f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
3 deletions
+12
-3
Lib/test/test_list.py
Lib/test/test_list.py
+5
-0
Misc/NEWS.d/next/Core and Builtins/2019-09-02-16-17-42.bpo-36946._lAuSR.rst
...ore and Builtins/2019-09-02-16-17-42.bpo-36946._lAuSR.rst
+1
-0
Modules/_ctypes/_ctypes.c
Modules/_ctypes/_ctypes.c
+2
-1
Objects/listobject.c
Objects/listobject.c
+4
-2
No files found.
Lib/test/test_list.py
View file @
3c87a667
...
@@ -150,6 +150,11 @@ class ListTest(list_tests.CommonTest):
...
@@ -150,6 +150,11 @@ class ListTest(list_tests.CommonTest):
a
[:]
=
data
a
[:]
=
data
self
.
assertEqual
(
list
(
it
),
[])
self
.
assertEqual
(
list
(
it
),
[])
def
test_step_overflow
(
self
):
a
=
[
0
,
1
,
2
,
3
,
4
]
a
[
1
::
sys
.
maxsize
]
=
[
0
]
self
.
assertEqual
(
a
[
3
::
sys
.
maxsize
],
[
3
])
def
test_no_comdat_folding
(
self
):
def
test_no_comdat_folding
(
self
):
# Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
# Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
# optimization causes failures in code that relies on distinct
# optimization causes failures in code that relies on distinct
...
...
Misc/NEWS.d/next/Core and Builtins/2019-09-02-16-17-42.bpo-36946._lAuSR.rst
0 → 100644
View file @
3c87a667
Fix possible signed integer overflow when handling slices. Patch by hongweipeng.
Modules/_ctypes/_ctypes.c
View file @
3c87a667
...
@@ -5195,7 +5195,8 @@ Pointer_subscript(PyObject *myself, PyObject *item)
...
@@ -5195,7 +5195,8 @@ Pointer_subscript(PyObject *myself, PyObject *item)
PyObject
*
np
;
PyObject
*
np
;
StgDictObject
*
stgdict
,
*
itemdict
;
StgDictObject
*
stgdict
,
*
itemdict
;
PyObject
*
proto
;
PyObject
*
proto
;
Py_ssize_t
i
,
len
,
cur
;
Py_ssize_t
i
,
len
;
size_t
cur
;
/* Since pointers have no length, and we want to apply
/* Since pointers have no length, and we want to apply
different semantics to negative indices than normal
different semantics to negative indices than normal
...
...
Objects/listobject.c
View file @
3c87a667
...
@@ -2789,7 +2789,8 @@ list_subscript(PyListObject* self, PyObject* item)
...
@@ -2789,7 +2789,8 @@ list_subscript(PyListObject* self, PyObject* item)
return
list_item
(
self
,
i
);
return
list_item
(
self
,
i
);
}
}
else
if
(
PySlice_Check
(
item
))
{
else
if
(
PySlice_Check
(
item
))
{
Py_ssize_t
start
,
stop
,
step
,
slicelength
,
cur
,
i
;
Py_ssize_t
start
,
stop
,
step
,
slicelength
,
i
;
size_t
cur
;
PyObject
*
result
;
PyObject
*
result
;
PyObject
*
it
;
PyObject
*
it
;
PyObject
**
src
,
**
dest
;
PyObject
**
src
,
**
dest
;
...
@@ -2925,7 +2926,8 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
...
@@ -2925,7 +2926,8 @@ list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value)
/* assign slice */
/* assign slice */
PyObject
*
ins
,
*
seq
;
PyObject
*
ins
,
*
seq
;
PyObject
**
garbage
,
**
seqitems
,
**
selfitems
;
PyObject
**
garbage
,
**
seqitems
,
**
selfitems
;
Py_ssize_t
cur
,
i
;
Py_ssize_t
i
;
size_t
cur
;
/* protect against a[::-1] = a */
/* protect against a[::-1] = a */
if
(
self
==
(
PyListObject
*
)
value
)
{
if
(
self
==
(
PyListObject
*
)
value
)
{
...
...
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