summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-14 23:12:17 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-14 23:12:17 (GMT)
commit78980438683d98076cd541d995a868fb5c9e4277 (patch)
tree6003323bfe4c38f0d9ca17f126fbcdf782752600 /Objects/unicodeobject.c
parent5f1cfbb5c056564e2692d2abcdc82f1944a3b2ec (diff)
downloadcpython-78980438683d98076cd541d995a868fb5c9e4277.zip
cpython-78980438683d98076cd541d995a868fb5c9e4277.tar.gz
cpython-78980438683d98076cd541d995a868fb5c9e4277.tar.bz2
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6a12d71..65393d2 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13521,7 +13521,7 @@ unicode_format_arg_parse(struct unicode_formatter_t *ctx,
"* 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 @@ unicode_format_arg_parse(struct unicode_formatter_t *ctx,
"* 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)