From: Georg Brandl Date: Thu, 8 Jun 2006 12:45:05 +0000 (+0000) Subject: Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. X-Git-Tag: v2.4.4c1~197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78fbb2a032a45f9e6938a0b35afe673bfdd53f19;p=thirdparty%2FPython%2Fcpython.git Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. (backport from rev. 46741) --- diff --git a/Python/getargs.c b/Python/getargs.c index 2d231ce14c34..be79b7516e32 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -552,12 +552,12 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf, 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);