Skip to content

Commit 669d50b

Browse files
committed
ec: check that reference pictures have matching parameters before using them.
Fixes out of array reads Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <[email protected]>
1 parent bdeb61c commit 669d50b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

libavcodec/error_resilience.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,22 @@ void ff_er_frame_end(ERContext *s)
859859
(s->avctx->skip_top + s->avctx->skip_bottom)) {
860860
return;
861861
}
862+
if (s->last_pic) {
863+
if (s->last_pic->f.width != s->cur_pic->f.width ||
864+
s->last_pic->f.height != s->cur_pic->f.height ||
865+
s->last_pic->f.format != s->cur_pic->f.format) {
866+
av_log(s->avctx, AV_LOG_WARNING, "Cannot use previous picture in error concealment\n");
867+
s->last_pic = NULL;
868+
}
869+
}
870+
if (s->next_pic) {
871+
if (s->next_pic->f.width != s->cur_pic->f.width ||
872+
s->next_pic->f.height != s->cur_pic->f.height ||
873+
s->next_pic->f.format != s->cur_pic->f.format) {
874+
av_log(s->avctx, AV_LOG_WARNING, "Cannot use next picture in error concealment\n");
875+
s->next_pic = NULL;
876+
}
877+
}
862878

863879
if (s->cur_pic->f.motion_val[0] == NULL) {
864880
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");

0 commit comments

Comments
 (0)