[FFmpeg-cvslog] avcodec/mpegvideo: Fix null pointer dereference with grayscale decoding with mpeg2_field_encoding.ts
Michael Niedermayer
git at videolan.org
Sat May 9 17:30:43 CEST 2015
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May 9 16:20:12 2015 +0200| [cf31e2df08e39082241c8e2e10eaacb115c69a6c] | committer: Michael Niedermayer
avcodec/mpegvideo: Fix null pointer dereference with grayscale decoding with mpeg2_field_encoding.ts
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf31e2df08e39082241c8e2e10eaacb115c69a6c
---
libavcodec/mpegvideo.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 1032442..11d6729 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1896,11 +1896,13 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
for(i=0; i<avctx->height; i++)
memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i,
0x80, avctx->width);
- for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
- memset(s->last_picture_ptr->f->data[1] + s->last_picture_ptr->f->linesize[1]*i,
- 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
- memset(s->last_picture_ptr->f->data[2] + s->last_picture_ptr->f->linesize[2]*i,
- 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+ if (s->last_picture_ptr->f->data[2]) {
+ for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
+ memset(s->last_picture_ptr->f->data[1] + s->last_picture_ptr->f->linesize[1]*i,
+ 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+ memset(s->last_picture_ptr->f->data[2] + s->last_picture_ptr->f->linesize[2]*i,
+ 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+ }
}
if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
More information about the ffmpeg-cvslog
mailing list