diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-11 20:12:40 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-11 20:12:40 (GMT) |
commit | f8d403dd972a354fadc939d54dc0a1c45ffda327 (patch) | |
tree | 13fd4898edc4b4ada740831a9b280320f5b00da1 /Python/ast.c | |
parent | 8ad64aaacc22d68d6d93c3c12f7e67e9962de09b (diff) | |
download | cpython-f8d403dd972a354fadc939d54dc0a1c45ffda327.zip cpython-f8d403dd972a354fadc939d54dc0a1c45ffda327.tar.gz cpython-f8d403dd972a354fadc939d54dc0a1c45ffda327.tar.bz2 |
SF #1377897, Bus error in ast
If a line had multiple semi-colons and ended with a semi-colon, we would
loop too many times and access a NULL node. Exit the loop early if
there are no more children.
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index 89ec217..04b2b3e 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2562,6 +2562,11 @@ ast_for_suite(struct compiling *c, const node *n) ch = CHILD(ch, 0); REQ(ch, simple_stmt); for (j = 0; j < NCH(ch); j += 2) { + /* statement terminates with a semi-colon ';' */ + if (NCH(CHILD(ch, j)) == 0) { + assert((j + 1) == NCH(ch)); + break; + } s = ast_for_stmt(c, CHILD(ch, j)); if (!s) goto error; |