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
2 changes: 2 additions & 0 deletions 2 Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ Gregory Bond
Matias Bordese
Jonas Borgström
Jurjen Bos
Jay Bosamiya
Peter Bosch
Dan Boswell
Eric Bouck
Expand Down Expand Up @@ -616,6 +617,7 @@ Alan Hourihane
Ken Howard
Brad Howes
Mike Hoy
Miro Hrončok
Chiu-Hsiang Hsu
Chih-Hao Huang
Christian Hudon
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed possible integer overflow in PyBytes_DecodeEscape, CVE-2017-1000158.
Original patch by Jay Bosamiya; rebased to Python 3 by Miro Hrončok.
8 changes: 7 additions & 1 deletion 8 Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ PyObject *PyBytes_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 = PyBytes_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.