]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking.
authorGeorg Brandl <georg@python.org>
Thu, 8 Jun 2006 12:45:05 +0000 (12:45 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 8 Jun 2006 12:45:05 +0000 (12:45 +0000)
 (backport from rev. 46741)

Python/getargs.c

index 2d231ce14c34c42935239605fad99b078d87627a..be79b7516e320f31b6b9d79719acf5e26c8286e0 100644 (file)
@@ -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<i>", 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<i>", 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<i>", arg, msgbuf, bufsize);