]> granicus.if.org Git - python/commitdiff
Merged revisions 72645 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 14 May 2009 21:54:00 +0000 (21:54 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 14 May 2009 21:54:00 +0000 (21:54 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72645 | antoine.pitrou | 2009-05-14 23:48:09 +0200 (jeu., 14 mai 2009) | 6 lines

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

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

Misc/NEWS
Modules/parsermodule.c

index 0c28db068531780bafec064df20bc1e86a6c0de3..9173a72e0d5c4babed4fea1140378cb14b14bf77 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,6 +23,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #5918: Fix a crash in the parser module.
+
 - Issue #1664: Make nntplib IPv6-capable. Patch by Derek Morr.
 
 - Issue #5006: Better handling of unicode byte-order marks (BOM) in the io
index 38ec65ee85e89f0e468815a1a4bfbdecb3b66546..49f6e23c41de4e0cdf5a0bbd284bbf0d264ec468 100644 (file)
@@ -1943,14 +1943,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)));