Skip to content

Commit 22ccbbc

Browse files
committed
Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking.
1 parent 06c5c8a commit 22ccbbc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Python/getargs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,12 +624,12 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
624624
ival = PyInt_AsLong(arg);
625625
if (ival == -1 && PyErr_Occurred())
626626
return converterr("integer<i>", arg, msgbuf, bufsize);
627-
else if (ival > INT_MAX) {
627+
else if (ival > LONG_MAX) {
628628
PyErr_SetString(PyExc_OverflowError,
629629
"signed integer is greater than maximum");
630630
return converterr("integer<i>", arg, msgbuf, bufsize);
631631
}
632-
else if (ival < INT_MIN) {
632+
else if (ival < LONG_MIN) {
633633
PyErr_SetString(PyExc_OverflowError,
634634
"signed integer is less than minimum");
635635
return converterr("integer<i>", arg, msgbuf, bufsize);

0 commit comments

Comments
 (0)