You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
lavc/mjpeg2jpeg: Check for jpeg file header.
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "libavutil/error.h"
|
#include "libavutil/error.h"
|
||||||
#include "libavutil/mem.h"
|
#include "libavutil/mem.h"
|
||||||
|
#include "libavutil/intreadwrite.h"
|
||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "jpegtables.h"
|
#include "jpegtables.h"
|
||||||
@@ -88,6 +89,10 @@ static int mjpeg2jpeg_filter(AVBitStreamFilterContext *bsfc,
|
|||||||
av_log(avctx, AV_LOG_ERROR, "input is truncated\n");
|
av_log(avctx, AV_LOG_ERROR, "input is truncated\n");
|
||||||
return AVERROR_INVALIDDATA;
|
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)) {
|
if (memcmp("AVI1", buf + 6, 4)) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "input is not MJPEG/AVI1\n");
|
av_log(avctx, AV_LOG_ERROR, "input is not MJPEG/AVI1\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
Reference in New Issue
Block a user