Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Gregory Bond
Matias Bordese
Jonas Borgström
Jurjen Bos
Jay Bosamiya
Peter Bosch
Dan Boswell
Eric Bouck
Expand Down
3 changes: 3 additions & 0 deletions 3 Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ What's New in Python 2.7.14?
Core and Builtins
-----------------

- bpo-30657: Fixed possible integer overflow in PyString_DecodeEscape.
Patch by Jay Bosamiya.

- bpo-27945: Fixed various segfaults with dict when input collections are
mutated during searching, inserting or comparing. Based on patches by
Duane Griffin and Tim Mitchell.
Expand Down
8 changes: 7 additions & 1 deletion 8 Objects/stringobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,13 @@ PyObject *PyString_DecodeEscape(const char *s,
char *p, *buf;
const char *end;
PyObject *v;
Py_ssize_t newlen = recode_encoding ? 4*len:len;
Py_ssize_t newlen;
/* Check for integer overflow */
if (recode_encoding && (len > PY_SSIZE_T_MAX / 4)) {
PyErr_SetString(PyExc_OverflowError, "string is too large");
return NULL;
}
newlen = recode_encoding ? 4*len:len;
v = PyString_FromStringAndSize((char *)NULL, newlen);
if (v == NULL)
return NULL;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.