]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpeg4video_parser.c
Check for several overreads, fixes issue 2512.
[ffmpeg] / libavcodec / mpeg4video_parser.c
index 06094c6f54911b4a6d2877222015326d1a4b3a26..5dbda8ba809e4423d86e66ef53e2541851da0b44 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "parser.h"
 #include "mpegvideo.h"
+#include "mpeg4video.h"
 #include "mpeg4video_parser.h"
 
 
@@ -82,7 +83,7 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
 
     init_get_bits(gb, buf, 8 * buf_size);
     ret = ff_mpeg4_decode_picture_header(s, gb);
-    if (s->width) {
+    if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) {
         avcodec_set_dimensions(avctx, s->width, s->height);
     }
     s1->pict_type= s->pict_type;