aboutsummaryrefslogtreecommitdiffstats
path: root/src/n3.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-04-19 22:59:41 +0200
committerDavid Robillard <d@drobilla.net>2018-04-19 22:59:41 +0200
commit0179f024aafea7f49a5abb459fa12a4ab2495b99 (patch)
tree541158b31ec494712fd5da0a9e41e54c1d80f84f /src/n3.c
parent2faabcaf2760a4c909d4be2f95057711e5eb9e23 (diff)
downloadserd-0179f024aafea7f49a5abb459fa12a4ab2495b99.tar.gz
serd-0179f024aafea7f49a5abb459fa12a4ab2495b99.tar.bz2
serd-0179f024aafea7f49a5abb459fa12a4ab2495b99.zip
Fix growing stack when parsing TriG files with many graphs
Diffstat (limited to 'src/n3.c')
-rw-r--r--src/n3.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/n3.c b/src/n3.c
index b97b0cd0..fd00360b 100644
--- a/src/n3.c
+++ b/src/n3.c
@@ -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");