Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 61712:7f15a6006162 2.6
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.
........
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Wed, 19 May 2010 00:07:47 +0000 |
| parents | e38335d4df91 |
| children | 9f5430e47770 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Tue May 18 23:58:06 2010 +0000 +++ b/Modules/parsermodule.c Wed May 19 00:07:47 2010 +0000 @@ -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)));
