summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-05-14 21:54:00 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-05-14 21:54:00 (GMT)
commit37d1c18bda0e1596c465c75f8fe928400899399a (patch)
tree947817e11a5a47fa89c175011bfc1849a29aa35b /Modules
parent7c8494b6e24b6efcef6386e0bb921cd08ecc68c6 (diff)
downloadcpython-37d1c18bda0e1596c465c75f8fe928400899399a.zip
cpython-37d1c18bda0e1596c465c75f8fe928400899399a.tar.gz
cpython-37d1c18bda0e1596c465c75f8fe928400899399a.tar.bz2
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. ........
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 38ec65e..49f6e23 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -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)));