From: Georg Brandl Date: Thu, 8 Jun 2006 12:45:01 +0000 (+0000) Subject: Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. X-Git-Tag: v2.5b1~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22ccbbc4ecc410f5bca7ffc31c56d4badc2d2772;p=python Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. --- diff --git a/Python/getargs.c b/Python/getargs.c index 1552790ef0..727376d640 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -624,12 +624,12 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, ival = PyInt_AsLong(arg); if (ival == -1 && PyErr_Occurred()) return converterr("integer", arg, msgbuf, bufsize); - else if (ival > INT_MAX) { + else if (ival > LONG_MAX) { PyErr_SetString(PyExc_OverflowError, "signed integer is greater than maximum"); return converterr("integer", arg, msgbuf, bufsize); } - else if (ival < INT_MIN) { + else if (ival < LONG_MIN) { PyErr_SetString(PyExc_OverflowError, "signed integer is less than minimum"); return converterr("integer", arg, msgbuf, bufsize);