diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/n3.c | 7 | ||||
-rw-r--r-- | test/bad/bad-datatype-syntax.ttl | 1 | ||||
-rw-r--r-- | test/bad/manifest.ttl | 6 |
4 files changed, 14 insertions, 3 deletions
@@ -3,10 +3,11 @@ serd (0.30.17) unstable; urgency=medium * Add Windows path separator support to serd_node_new_file_uri() * Fix crash when trying to read chunks without starting * Fix hang when skipping an error at EOF when lax parsing + * Gracefully handle bad characters in Turtle datatype syntax * Override pkg-config dependency within meson * Test header for warnings more strictly - -- David Robillard <d@drobilla.net> Mon, 14 Nov 2022 21:06:21 +0000 + -- David Robillard <d@drobilla.net> Thu, 24 Nov 2022 20:51:55 +0000 serd (0.30.16) stable; urgency=medium @@ -943,12 +943,15 @@ read_literal(SerdReader* const reader, break; case '^': eat_byte_safe(reader, '^'); - eat_byte_check(reader, '^'); + if (!eat_byte_check(reader, '^')) { + return r_err(reader, SERD_ERR_BAD_SYNTAX, "expected `^'\n"); + } + if ((st = read_iri(reader, datatype, ate_dot))) { *datatype = pop_node(reader, *datatype); *lang = pop_node(reader, *lang); *dest = pop_node(reader, *dest); - return r_err(reader, st, "bad literal\n"); + return r_err(reader, st, "bad datatype\n"); } break; } diff --git a/test/bad/bad-datatype-syntax.ttl b/test/bad/bad-datatype-syntax.ttl new file mode 100644 index 00000000..541c25d4 --- /dev/null +++ b/test/bad/bad-datatype-syntax.ttl @@ -0,0 +1 @@ +<http://example.org/s> <http://example.org/p> "value"^<http://example.org/t> . diff --git a/test/bad/manifest.ttl b/test/bad/manifest.ttl index 5f208983..0f4f1338 100644 --- a/test/bad/manifest.ttl +++ b/test/bad/manifest.ttl @@ -28,6 +28,7 @@ <#bad-char-in-local> <#bad-char-in-prefix> <#bad-char-in-uri> + <#bad-datatype-syntax> <#bad-datatype> <#bad-dot-after-subject> <#bad-dot-in-collection> @@ -185,6 +186,11 @@ mf:name "bad-char-in-uri" ; mf:action <bad-char-in-uri.ttl> . +<#bad-datatype-syntax> + rdf:type rdft:TestTurtleNegativeSyntax ; + mf:name "bad-datatype-syntax" ; + mf:action <bad-datatype-syntax.ttl> . + <#bad-datatype> rdf:type rdft:TestTurtleNegativeSyntax ; mf:name "bad-datatype" ; |