From 01485668012c55f8d405266ad9208a9bc915a523 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 25 Feb 2020 19:57:36 +0100 Subject: Emit reader errors on stack overflows in string literals --- src/n3.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/n3.c b/src/n3.c index f3811d18..a91a8367 100644 --- a/src/n3.c +++ b/src/n3.c @@ -357,7 +357,11 @@ read_STRING_LITERAL_LONG(SerdReader* reader, SerdNode* ref, uint8_t q) } } - return (st && reader->strict) ? st : SERD_SUCCESS; + if (st && reader->strict) { + r_err(reader, st, "failed to read literal (%s)\n", serd_strerror(st)); + } + + return (st && reader->strict) ? SERD_ERR_BAD_SYNTAX : st; } // STRING_LITERAL_QUOTE and STRING_LITERAL_SINGLE_QUOTE @@ -393,6 +397,10 @@ read_STRING_LITERAL(SerdReader* reader, SerdNode* ref, uint8_t q) } } + if (st && reader->strict) { + r_err(reader, st, "failed to read literal (%s)\n", serd_strerror(st)); + } + return st; } -- cgit v1.2.1