Skip to content

Commit

Permalink
obu: Handle size == 0 in avifBitsInit
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vigneshvg committed May 2, 2024
1 parent db8815a commit 90efc1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/obu.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void avifBitsInit(avifBits * const bits, const uint8_t * const data, cons
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)
Expand Down

0 comments on commit 90efc1e

Please sign in to comment.