diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-21 19:37:29 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-21 19:38:24 +0400 |
commit | 669d50b445960a7929cd4240bd1a086ab7843c92 (patch) | |
tree | c2ed960dfc18f788b260e4328e2961f036896062 /libavcodec/error_resilience.c | |
parent | bdeb61ccc67911cfc5e20c7cfb1312d0501ca90a (diff) |
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 <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/error_resilience.c')
-rw-r--r-- | libavcodec/error_resilience.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 20460b5698..fff94ab50d 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -859,6 +859,22 @@ void ff_er_frame_end(ERContext *s) (s->avctx->skip_top + s->avctx->skip_bottom)) { return; } + if (s->last_pic) { + if (s->last_pic->f.width != s->cur_pic->f.width || + s->last_pic->f.height != s->cur_pic->f.height || + s->last_pic->f.format != s->cur_pic->f.format) { + av_log(s->avctx, AV_LOG_WARNING, "Cannot use previous picture in error concealment\n"); + s->last_pic = NULL; + } + } + if (s->next_pic) { + if (s->next_pic->f.width != s->cur_pic->f.width || + s->next_pic->f.height != s->cur_pic->f.height || + s->next_pic->f.format != s->cur_pic->f.format) { + av_log(s->avctx, AV_LOG_WARNING, "Cannot use next picture in error concealment\n"); + s->next_pic = NULL; + } + } if (s->cur_pic->f.motion_val[0] == NULL) { av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); |