diff options
author | Gyan Doshi <ffmpeg@gyani.pro> | 2020-01-26 20:50:30 +0530 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2020-01-26 21:44:38 +0530 |
commit | 724e6b3d63786a910188a83a0d30c67c4fb359a9 (patch) | |
tree | 31eae7dc96ebf2d5a979788fb56c609c707964d1 | |
parent | 609dfb4057cdd68dae779fef81865c83152e16da (diff) | |
download | ffmpeg-724e6b3d63786a910188a83a0d30c67c4fb359a9.tar.gz |
avformat/yuv4mpegdec: better error logging
-rw-r--r-- | libavformat/yuv4mpegdec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c index eceb945bb1..d7b472e6c7 100644 --- a/libavformat/yuv4mpegdec.c +++ b/libavformat/yuv4mpegdec.c @@ -53,10 +53,14 @@ static int yuv4_read_header(AVFormatContext *s) break; } } - if (i == MAX_YUV4_HEADER) - return -1; - if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) - return -1; + if (i == MAX_YUV4_HEADER) { + av_log(s, AV_LOG_ERROR, "Header too large.\n"); + return AVERROR(EINVAL); + } + if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) { + av_log(s, AV_LOG_ERROR, "Invalid magic number for yuv4mpeg.\n"); + return AVERROR(EINVAL); + } header_end = &header[i + 1]; // Include space for (tokstart = &header[strlen(Y4M_MAGIC) + 1]; |