Issue #23450: Fixed possible integer overflows.

This commit is contained in:
Serhiy Storchaka 2015-02-16 20:52:17 +02:00
parent 4d0d982985
commit 26861b0b29
8 changed files with 64 additions and 50 deletions

View file

@ -1006,7 +1006,7 @@ PyObject *PyCodec_NameReplaceErrors(PyObject *exc)
c = PyUnicode_READ_CHAR(object, i);
if (ucnhash_CAPI &&
ucnhash_CAPI->getname(NULL, c, buffer, sizeof(buffer), 1)) {
replsize = 1+1+1+strlen(buffer)+1;
replsize = 1+1+1+(int)strlen(buffer)+1;
}
else if (c >= 0x10000) {
replsize = 1+1+8;

View file

@ -279,7 +279,7 @@ w_ref(PyObject *v, char *flag, WFILE *p)
PyErr_SetString(PyExc_ValueError, "too many objects");
goto err;
}
w = s;
w = (int)s;
Py_INCREF(v);
if (_Py_HASHTABLE_SET(p->hashtable, v, w) < 0) {
Py_DECREF(v);