mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks.
This commit is contained in:
parent
5f1cfbb5c0
commit
7898043868
19 changed files with 148 additions and 24 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue