aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-05-10 15:31:22 +0200
committerDavid Robillard <d@drobilla.net>2018-06-10 19:57:44 +0000
commite3a491db47da8ae03d6390e71652ca53779fb393 (patch)
tree83e87c0400b575bf42738e7136ae58df2d17fb22 /src/reader.c
parentd208424fdb4e8b516aff2a5a0d03fc7411909471 (diff)
downloadserd-e3a491db47da8ae03d6390e71652ca53779fb393.tar.gz
serd-e3a491db47da8ae03d6390e71652ca53779fb393.tar.bz2
serd-e3a491db47da8ae03d6390e71652ca53779fb393.zip
Fix byte source to never read past end of strings
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/reader.c b/src/reader.c
index d515aaab..e9210927 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -348,16 +348,12 @@ serd_reader_read_chunk(SerdReader* reader)
{
SerdStatus st = SERD_SUCCESS;
if (!reader->source.prepared) {
- if ((st = serd_reader_prepare(reader))) {
- return st;
- }
+ st = serd_reader_prepare(reader);
} else if (reader->source.eof) {
- reader->source.eof = false;
- if ((st = serd_byte_source_advance(&reader->source))) {
- return st;
- }
+ st = serd_byte_source_advance(&reader->source);
}
- return read_statement(reader) ? SERD_SUCCESS : SERD_FAILURE;
+
+ return st ? st : read_statement(reader) ? SERD_SUCCESS : SERD_FAILURE;
}
SERD_API