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
32d2ce35
Commit
32d2ce35
authored
Jul 25, 2016
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #27581: Merge overflow fix from 3.5
parents
c665dfd7
e8db861f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
Misc/NEWS
Misc/NEWS
+3
-0
Objects/abstract.c
Objects/abstract.c
+5
-4
No files found.
Misc/NEWS
View file @
32d2ce35
...
...
@@ -13,6 +13,9 @@ Core and Builtins
- Issue #27507: Add integer overflow check in bytearray.extend(). Patch by
Xiang Zhang.
- Issue #27581: Don'
t
rely
on
wrapping
for
overflow
check
in
PySequence_Tuple
().
Patch
by
Xiang
Zhang
.
-
Issue
#
27419
:
Standard
__import__
()
no
longer
look
up
"__import__"
in
globals
or
builtins
for
importing
submodules
or
"from import"
.
Fixed
a
crash
if
raise
a
warning
about
unabling
to
resolve
package
from
__spec__
or
...
...
Objects/abstract.c
View file @
32d2ce35
...
...
@@ -1747,21 +1747,22 @@ PySequence_Tuple(PyObject *v)
break
;
}
if
(
j
>=
n
)
{
Py_ssize_t
oldn
=
n
;
size_t
newn
=
(
size_t
)
n
;
/* The over-allocation strategy can grow a bit faster
than for lists because unlike lists the
over-allocation isn't permanent -- we reclaim
the excess before the end of this routine.
So, grow by ten and then add 25%.
*/
n
+=
10
;
n
+=
n
>>
2
;
if
(
n
<
oldn
)
{
n
ewn
+=
10u
;
n
ewn
+=
new
n
>>
2
;
if
(
n
ewn
>
PY_SSIZE_T_MAX
)
{
/* Check for overflow */
PyErr_NoMemory
();
Py_DECREF
(
item
);
goto
Fail
;
}
n
=
(
Py_ssize_t
)
newn
;
if
(
_PyTuple_Resize
(
&
result
,
n
)
!=
0
)
{
Py_DECREF
(
item
);
goto
Fail
;
...
...
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