ref: 1efea985698591000cfa9b32964a0e7a3be03794
parent: e9df70c4348a3f9ba7269feacd17cfb57bf23852
author: Wan-Teh Chang <wtc@google.com>
date: Fri Jun 19 22:30:27 EDT 2020
Assert sz is nonzero in dav1d_init_get_bits() dav1d_init_get_bits() initializes c->eof to 0, which implies c->ptr < c->ptr_end, or equivalently sz > 0.
--- a/src/getbits.c
+++ b/src/getbits.c
@@ -34,6 +34,8 @@
void dav1d_init_get_bits(GetBits *const c, const uint8_t *const data,
const size_t sz)
{
+ // If sz were 0, c->eof would need to be initialized to 1.
+ assert(sz);
c->ptr = c->ptr_start = data;
c->ptr_end = &c->ptr_start[sz];
c->bits_left = 0;