summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-18 19:53:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-01-16 00:35:12 +0100
commita2186a8054428807d7bcd9ee29342e8741177f9c (patch)
tree3ddea34f36425c57a6bf27b1eedbd01e11231d4d
parenta92b73da9907cc6819b5a476747a5ab44c797c88 (diff)
downloadffmpeg-a2186a8054428807d7bcd9ee29342e8741177f9c.tar.gz
avcodec/mpegvideo_motion: Check P field references
If a reference is unavailable use a field from the current picture Fixes null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 23daee0dcc57b647b9d62d4c905e94acf0c6b8e0) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpegvideo_motion.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 565f6cb286..f443b8e629 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -812,7 +812,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
}
} else {
- if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){
+ if( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
+ || !ref_picture[0]){
ref_picture = s->current_picture_ptr->f.data;
}