Fix wrong assignment if stride or sbh change, but stride * sbh don't

Credit to oss-fuzz.
This commit is contained in:
Ronald S. Bultje
2021-11-11 07:29:05 -05:00
parent 0930f1b1b8
commit c7a5b90001
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -3060,7 +3060,8 @@ int dav1d_decode_frame_init(Dav1dFrameContext *const f) {
const int need_cdef_lpf_copy = c->n_tc > 1 && has_resize;
if (y_stride * f->sbh * 4 != f->lf.cdef_buf_plane_sz[0] ||
uv_stride * f->sbh * 8 != f->lf.cdef_buf_plane_sz[1] ||
need_cdef_lpf_copy != f->lf.need_cdef_lpf_copy)
need_cdef_lpf_copy != f->lf.need_cdef_lpf_copy ||
f->sbh != f->lf.cdef_buf_sbh)
{
dav1d_free_aligned(f->lf.cdef_line_buf);
size_t alloc_sz = 64;
@@ -3112,6 +3113,7 @@ int dav1d_decode_frame_init(Dav1dFrameContext *const f) {
f->lf.cdef_buf_plane_sz[0] = (int) y_stride * f->sbh * 4;
f->lf.cdef_buf_plane_sz[1] = (int) uv_stride * f->sbh * 8;
f->lf.need_cdef_lpf_copy = need_cdef_lpf_copy;
f->lf.cdef_buf_sbh = f->sbh;
}
const int sb128 = f->seq_hdr->sb128;
+1
View File
@@ -275,6 +275,7 @@ struct Dav1dFrameContext {
Av1Restoration *lr_mask;
int mask_sz /* w*h */, lr_mask_sz;
int cdef_buf_plane_sz[2]; /* stride*sbh*4 */
int cdef_buf_sbh;
int lr_buf_plane_sz[2]; /* (stride*sbh*4) << sb128 if n_tc > 1, else stride*4 */
int re_sz /* h */;
ALIGN(Av1FilterLUT lim_lut, 16);