diff options
author | Damien George <damien.p.george@gmail.com> | 2015-07-24 15:05:56 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-07-24 15:05:56 +0000 |
commit | 96f0dd3cbc404b7f96bd7a35247faea8da266638 (patch) | |
tree | 40a8158c2ac570d5a895a680063742a41bd7d1cd /py/parse.c | |
parent | fa7c61dfab0822619451673d726a5b444d3a9d28 (diff) | |
download | micropython-96f0dd3cbc404b7f96bd7a35247faea8da266638.tar.gz micropython-96f0dd3cbc404b7f96bd7a35247faea8da266638.zip |
py/parse: Fix handling of empty input so it raises an exception.
Diffstat (limited to 'py/parse.c')
-rw-r--r-- | py/parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/py/parse.c b/py/parse.c index ad13a90309..b20fdaacd2 100644 --- a/py/parse.c +++ b/py/parse.c @@ -720,6 +720,11 @@ memory_error: goto syntax_error; } + // check that parsing resulted in a parse node (can fail on empty input) + if (parser.result_stack_top == 0) { + goto syntax_error; + } + //result_stack_show(parser); //printf("rule stack alloc: %d\n", parser.rule_stack_alloc); //printf("result stack alloc: %d\n", parser.result_stack_alloc); |