diff options
author | David Robillard <d@drobilla.net> | 2018-04-19 22:59:41 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-04-19 22:59:41 +0200 |
commit | 0179f024aafea7f49a5abb459fa12a4ab2495b99 (patch) | |
tree | 541158b31ec494712fd5da0a9e41e54c1d80f84f /src | |
parent | 2faabcaf2760a4c909d4be2f95057711e5eb9e23 (diff) | |
download | serd-0179f024aafea7f49a5abb459fa12a4ab2495b99.tar.gz serd-0179f024aafea7f49a5abb459fa12a4ab2495b99.tar.bz2 serd-0179f024aafea7f49a5abb459fa12a4ab2495b99.zip |
Fix growing stack when parsing TriG files with many graphs
Diffstat (limited to 'src')
-rw-r--r-- | src/n3.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1391,6 +1391,8 @@ read_n3_statement(SerdReader* reader) TRY_RET((ctx.graph = read_labelOrSubject(reader, ctx))); read_ws_star(reader); TRY_RET(read_wrappedGraph(reader, &ctx)); + pop_node(reader, ctx.graph); + ctx.graph = 0; read_ws_star(reader); } else if (read_ws_star(reader) && peek_byte(reader) == '{') { if (s_type == '(' || (s_type == '[' && !*ctx.flags)) { @@ -1400,6 +1402,7 @@ read_n3_statement(SerdReader* reader) ctx.graph = subj; ctx.subject = subj = 0; TRY_RET(read_wrappedGraph(reader, &ctx)); + pop_node(reader, ctx.graph); read_ws_star(reader); } else if (!subj) { ret = r_err(reader, SERD_ERR_BAD_SYNTAX, "bad subject\n"); |