summaryrefslogtreecommitdiffstats
path: root/Modules/_codecsmodule.c
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-10-06 17:05:14 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-10-06 17:05:14 (GMT)
commitff9c54aca28592a3eab0bdba1ddd977b441e1e9f (patch)
tree9ffb1c0c0b9aad8615cfae28c3ebbea5c67c4752 /Modules/_codecsmodule.c
parent7e3cde590140052776ad219817e7bd7b87e3d4cd (diff)
parentc04ddff290fc203d05b75c8569b748525fb76b5b (diff)
downloadcpython-ff9c54aca28592a3eab0bdba1ddd977b441e1e9f.zip
cpython-ff9c54aca28592a3eab0bdba1ddd977b441e1e9f.tar.gz
cpython-ff9c54aca28592a3eab0bdba1ddd977b441e1e9f.tar.bz2
Issue #16096: Merge fixes from 3.3.
Diffstat (limited to 'Modules/_codecsmodule.c')
-rw-r--r--Modules/_codecsmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 7818f9a..40037b1 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -177,12 +177,12 @@ escape_encode(PyObject *self,
return NULL;
size = PyBytes_GET_SIZE(str);
- newsize = 4*size;
- if (newsize > PY_SSIZE_T_MAX || newsize / 4 != size) {
+ if (size > PY_SSIZE_T_MAX / 4) {
PyErr_SetString(PyExc_OverflowError,
"string is too large to encode");
return NULL;
}
+ newsize = 4*size;
v = PyBytes_FromStringAndSize(NULL, newsize);
if (v == NULL) {