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
f8c4b3a7
Commit
f8c4b3a7
authored
Sep 29, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix overflow checking in PyString_Repr (closes #22519)
parent
b2c43284
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
Misc/NEWS
Misc/NEWS
+2
-0
Objects/stringobject.c
Objects/stringobject.c
+3
-2
No files found.
Misc/NEWS
View file @
f8c4b3a7
...
...
@@ -10,6 +10,8 @@ What's New in Python 2.7.9?
Core and Builtins
-----------------
- Issue #22519: Fix overflow checking in PyString_Repr.
- Issue #22518: Fix integer overflow issues in latin-1 encoding.
- Issue #22379: Fix empty exception message in a TypeError raised in
...
...
Objects/stringobject.c
View file @
f8c4b3a7
...
...
@@ -926,13 +926,14 @@ PyObject *
PyString_Repr
(
PyObject
*
obj
,
int
smartquotes
)
{
register
PyStringObject
*
op
=
(
PyStringObject
*
)
obj
;
size_t
newsize
=
2
+
4
*
Py_SIZE
(
op
)
;
size_t
newsize
;
PyObject
*
v
;
if
(
newsize
>
PY_SSIZE_T_MAX
||
newsize
/
4
!=
Py_SIZE
(
op
)
)
{
if
(
Py_SIZE
(
op
)
>
(
PY_SSIZE_T_MAX
-
2
)
/
4
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"string is too large to make repr"
);
return
NULL
;
}
newsize
=
2
+
4
*
Py_SIZE
(
op
);
v
=
PyString_FromStringAndSize
((
char
*
)
NULL
,
newsize
);
if
(
v
==
NULL
)
{
return
NULL
;
...
...
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