]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 72645 via svnmerge from
authorGeorg Brandl <georg@python.org>
Wed, 19 May 2010 00:07:47 +0000 (00:07 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 19 May 2010 00:07:47 +0000 (00:07 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72645 | antoine.pitrou | 2009-05-14 21:48:09 +0000 (Do, 14 Mai 2009) | 6 lines

  Issue #5918: Fix a crash in the parser module.

  Patch by Amaury.
........

Misc/NEWS
Modules/parsermodule.c

index 09ab65eae9f8ce08e5b18758ed732078b6c1c623..ee4bf2b787541d0bd3eab5dbc7e912d930a964b1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -44,6 +44,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #5918: Fix a crash in the parser module.
+
 - Issue #8688: Distutils now recalculates MANIFEST everytime.
 
 - Issue #7640: In the new `io` module, fix relative seek() for buffered
index 0dd69cda1a4f83c2d1266fb3ac4e566024a68559..425d97f6bfadc205857e2a4a5ac2d0ed1ad019b2 100644 (file)
@@ -2092,14 +2092,14 @@ validate_try(node *tree)
         return (res);
     }
     /* try/except statement: skip past except_clause sections */
-    while (res && (TYPE(CHILD(tree, pos)) == except_clause)) {
+    while (res && pos < nch && (TYPE(CHILD(tree, pos)) == except_clause)) {
         res = (validate_except_clause(CHILD(tree, pos))
                && validate_colon(CHILD(tree, pos + 1))
                && validate_suite(CHILD(tree, pos + 2)));
         pos += 3;
     }
     /* skip else clause */
-    if (res && (TYPE(CHILD(tree, pos)) == NAME) &&
+    if (res && pos < nch && (TYPE(CHILD(tree, pos)) == NAME) &&
         (strcmp(STR(CHILD(tree, pos)), "else") == 0)) {
         res = (validate_colon(CHILD(tree, pos + 1))
                && validate_suite(CHILD(tree, pos + 2)));