[Python-checkins] r72648 - in python/branches/py3k: Misc/NEWS Modules/parsermodule.c

antoine.pitrou python-checkins at python.org
Thu May 14 23:54:00 CEST 2009


Author: antoine.pitrou
Date: Thu May 14 23:54:00 2009
New Revision: 72648

Log:
Merged revisions 72645 via svnmerge from 
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.
........


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/parsermodule.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu May 14 23:54:00 2009
@@ -23,6 +23,8 @@
 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

Modified: python/branches/py3k/Modules/parsermodule.c
==============================================================================
--- python/branches/py3k/Modules/parsermodule.c	(original)
+++ python/branches/py3k/Modules/parsermodule.c	Thu May 14 23:54:00 2009
@@ -1943,14 +1943,14 @@
         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)));


More information about the Python-checkins mailing list