diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 12:41:45 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-19 12:41:45 +0200 |
commit | 9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3 (patch) | |
tree | c61aebdba4dddc8f10c9460ca33b0fa3f2e1495d /Objects/unicodeobject.c | |
parent | bd8f29028eab752e8e5c73703218a701028c1a9a (diff) | |
parent | 441d30fac7f4037e4a79e4ada873de3b6f6e5a26 (diff) | |
download | cpython-git-9101e23ff6006d9ede7d46e8c9e7d39e23c2a3c3.tar.gz |
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
This is a backport of changesets 13e2e44db99d and 525407d89277.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 044b26e7fc..b57a8963b9 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13569,7 +13569,7 @@ PyUnicode_Format(PyObject *format, PyObject *args) "* wants int"); goto onError; } - width = PyLong_AsLong(v); + width = PyLong_AsSsize_t(v); if (width == -1 && PyErr_Occurred()) goto onError; if (width < 0) { @@ -13609,7 +13609,7 @@ PyUnicode_Format(PyObject *format, PyObject *args) "* wants int"); goto onError; } - prec = PyLong_AsLong(v); + prec = _PyLong_AsInt(v); if (prec == -1 && PyErr_Occurred()) goto onError; if (prec < 0) |