]> granicus.if.org Git - python/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:01 +0000 (12:45 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 8 Jun 2006 12:45:01 +0000 (12:45 +0000)
Python/getargs.c

index 1552790ef0805281b58051175a73f8abfeca9bb7..727376d640aa1dde5e0883a6ded915e092a6b394 100644 (file)
@@ -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<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);