Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 81505:13e2e44db99d
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
| author | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| date | Tue, 15 Jan 2013 01:12:17 +0200 |
| parents | 0c04ed40eeaf |
| children | 03e22cc9407a |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Tue Jan 15 00:41:43 2013 +0200 +++ b/Objects/unicodeobject.c Tue Jan 15 01:12:17 2013 +0200 @@ -13521,7 +13521,7 @@ "* wants int"); return -1; } - arg->width = PyLong_AsLong(v); + arg->width = PyLong_AsSsize_t(v); if (arg->width == -1 && PyErr_Occurred()) return -1; if (arg->width < 0) { @@ -13568,7 +13568,7 @@ "* wants int"); return -1; } - arg->prec = PyLong_AsLong(v); + arg->prec = _PyLong_AsInt(v); if (arg->prec == -1 && PyErr_Occurred()) return -1; if (arg->prec < 0)
