]> granicus.if.org Git - python/commitdiff
Re #18521: move array bounds check before array access.
authorGeorg Brandl <georg@python.org>
Mon, 14 Oct 2013 05:01:11 +0000 (07:01 +0200)
committerGeorg Brandl <georg@python.org>
Mon, 14 Oct 2013 05:01:11 +0000 (07:01 +0200)
Python/getargs.c

index 2c2628f9a1285d99b4bcb030cadbebb008160c28..9d727523201dfb836d05591761db93e6ebf1c227 100644 (file)
@@ -376,7 +376,7 @@ seterror(Py_ssize_t iarg, const char *msg, int *levels, const char *fname,
                           "argument %" PY_FORMAT_SIZE_T "d", iarg);
             i = 0;
             p += strlen(p);
-            while (levels[i] > 0 && i < 32 && (int)(p-buf) < 220) {
+            while (i < 32 && levels[i] > 0 && (int)(p-buf) < 220) {
                 PyOS_snprintf(p, sizeof(buf) - (p - buf),
                               ", item %d", levels[i]-1);
                 p += strlen(p);