[Python-checkins] r81315 - in python/branches/release26-maint: Misc/NEWS Modules/parsermodule.c

georg.brandl python-checkins at python.org
Wed May 19 02:07:48 CEST 2010


Author: georg.brandl
Date: Wed May 19 02:07:47 2010
New Revision: 81315

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


Modified:
   python/branches/release26-maint/   (props changed)
   python/branches/release26-maint/Misc/NEWS
   python/branches/release26-maint/Modules/parsermodule.c

Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS	(original)
+++ python/branches/release26-maint/Misc/NEWS	Wed May 19 02:07:47 2010
@@ -44,6 +44,8 @@
 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

Modified: python/branches/release26-maint/Modules/parsermodule.c
==============================================================================
--- python/branches/release26-maint/Modules/parsermodule.c	(original)
+++ python/branches/release26-maint/Modules/parsermodule.c	Wed May 19 02:07:47 2010
@@ -2092,14 +2092,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