aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2016-01-12 16:13:27 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2016-01-12 16:13:27 +0100
commit27fa70fdfe87b7cb54c1852f2922fafa16370c01 (patch)
treee5016632a8cb9daa9cca82a259b73b390eac1b8d
parentadef8ee794aa1b09e2e6095a59b5a291635ac44f (diff)
downloadffmpeg-27fa70fdfe87b7cb54c1852f2922fafa16370c01.tar.gz
lavc/mjpeg2jpeg: Check for jpeg file header.
-rw-r--r--libavcodec/mjpeg2jpeg_bsf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/mjpeg2jpeg_bsf.c b/libavcodec/mjpeg2jpeg_bsf.c
index 68640db9e6..71f015491a 100644
--- a/libavcodec/mjpeg2jpeg_bsf.c
+++ b/libavcodec/mjpeg2jpeg_bsf.c
@@ -28,6 +28,7 @@
#include "libavutil/error.h"
#include "libavutil/mem.h"
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "jpegtables.h"
@@ -88,6 +89,10 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc,
av_log(avctx, AV_LOG_ERROR, "input is truncated\n");
return AVERROR_INVALIDDATA;
}
+ if (AV_RB16(buf) != 0xffd8) {
+ av_log(avctx, AV_LOG_ERROR, "input is not MJPEG\n");
+ return AVERROR_INVALIDDATA;
+ }
if (memcmp("AVI1", buf + 6, 4)) {
av_log(avctx, AV_LOG_ERROR, "input is not MJPEG/AVI1\n");
return AVERROR_INVALIDDATA;