aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/byte_source.c4
-rw-r--r--test/test_reader_writer.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index df757376..2e4f66cb 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -87,6 +87,10 @@ serd_byte_source_open_source(SerdByteSource* const source,
SerdStatus
serd_byte_source_prepare(SerdByteSource* const source)
{
+ if (source->page_size == 0) {
+ return SERD_FAILURE;
+ }
+
source->prepared = true;
if (source->from_stream) {
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 41f6aee0..8671a649 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -149,6 +149,9 @@ test_reader(const char* path)
SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0u, sink, 4096);
assert(reader);
+ assert(serd_reader_read_document(reader) == SERD_FAILURE);
+ assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
+
serd_reader_add_blank_prefix(reader, "tmp");
#if defined(__GNUC__)