summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-19 00:07:47 (GMT)
committerGeorg Brandl <georg@python.org>2010-05-19 00:07:47 (GMT)
commitf72cae4afa3f6f60e20401c2c02bf6411d761774 (patch)
tree3f5f846ce98f8d2b1b24879606848a4aef084cb6 /Modules
parent4605aa2a093788987ff1f37189b5d40a90788724 (diff)
downloadcpython-f72cae4afa3f6f60e20401c2c02bf6411d761774.zip
cpython-f72cae4afa3f6f60e20401c2c02bf6411d761774.tar.gz
cpython-f72cae4afa3f6f60e20401c2c02bf6411d761774.tar.bz2
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. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/parsermodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 0dd69cd..425d97f 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -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)));