aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-25 16:30:50 +0000
committerDavid Robillard <d@drobilla.net>2011-01-25 16:30:50 +0000
commit03e48f15a3635cfef0392b87e6ad7b7702ba2bcb (patch)
treeb6cd8af5e445f341486cc810e8ca42cb92fabadb
parentda60fb781d5fcd4d0b3852cf9586d4f6ebed7dd9 (diff)
downloadserd-03e48f15a3635cfef0392b87e6ad7b7702ba2bcb.tar.gz
serd-03e48f15a3635cfef0392b87e6ad7b7702ba2bcb.tar.bz2
serd-03e48f15a3635cfef0392b87e6ad7b7702ba2bcb.zip
Fix handling of EOF in collections.
git-svn-id: http://svn.drobilla.net/serd/trunk@65 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r--src/reader.c4
-rw-r--r--tests/bad-list.ttl1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/reader.c b/src/reader.c
index fb539819..04891658 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1030,7 +1030,7 @@ inline static bool
is_object_end(const uint8_t c)
{
switch (c) {
- case 0x9: case 0xA: case 0xD: case 0x20:
+ case 0x9: case 0xA: case 0xD: case 0x20: case '\0':
case '#': case '.': case ';':
return true;
default:
@@ -1053,6 +1053,7 @@ read_object(SerdReader reader, ReadContext ctx)
Node o = INTERNAL_NODE_NULL;
const uint8_t c = peek_byte(reader);
switch (c) {
+ case '\0':
case ')':
return false;
case '[': case '(':
@@ -1205,7 +1206,6 @@ read_collection(SerdReader reader, ReadContext ctx, Node* dest)
ctx.subject = dest;
ctx.predicate = &reader->rdf_first;
if (!read_object(reader, ctx)) {
- pop_string(reader, dest->value);
return error(reader, "unexpected end of collection\n");
}
diff --git a/tests/bad-list.ttl b/tests/bad-list.ttl
new file mode 100644
index 00000000..60e21351
--- /dev/null
+++ b/tests/bad-list.ttl
@@ -0,0 +1 @@
+<> <http://example.org/pred> ( \ No newline at end of file