obu: Handle size == 0 in avifBitsInit
If size == 0, eof has to be set to 1 in avifBitsInit for the
rest of the code to work as intended. Otherwise the first byte
is read unconditionally which is incorrect.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=68568
diff --git a/src/obu.c b/src/obu.c
index 60e41bf..abd2628 100644
--- a/src/obu.c
+++ b/src/obu.c
@@ -66,7 +66,7 @@
bits->bitsLeft = 0;
bits->state = 0;
bits->error = 0;
- bits->eof = 0;
+ bits->eof = (size == 0);
}
static void avifBitsRefill(avifBits * const bits, const uint32_t n)