[FFmpeg-cvslog] avformat/ffmdec: Check pix_fmt
Michael Niedermayer
git at videolan.org
Fri Apr 29 13:28:09 CEST 2016
ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Thu Apr 28 22:50:48 2016 +0200| [2a158602273f9e8875280e5202de6d7e19845c80] | committer: Michael Niedermayer
avformat/ffmdec: Check pix_fmt
Fixes crash
Fixes Ticket5412
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 78baa450d9939957f52d5187beb95d763d2f1f18)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a158602273f9e8875280e5202de6d7e19845c80
---
libavformat/ffmdec.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 363d1db..541f5b2 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -27,6 +27,7 @@
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
+#include "libavutil/pixdesc.h"
#include "avformat.h"
#include "internal.h"
#include "ffm.h"
@@ -366,6 +367,11 @@ static int ffm2_read_header(AVFormatContext *s)
codec->height = avio_rb16(pb);
codec->gop_size = avio_rb16(pb);
codec->pix_fmt = avio_rb32(pb);
+ if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
+ av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
+ codec->pix_fmt = AV_PIX_FMT_NONE;
+ goto fail;
+ }
codec->qmin = avio_r8(pb);
codec->qmax = avio_r8(pb);
codec->max_qdiff = avio_r8(pb);
@@ -558,6 +564,11 @@ static int ffm_read_header(AVFormatContext *s)
codec->height = avio_rb16(pb);
codec->gop_size = avio_rb16(pb);
codec->pix_fmt = avio_rb32(pb);
+ if (!av_pix_fmt_desc_get(codec->pix_fmt)) {
+ av_log(s, AV_LOG_ERROR, "Invalid pix fmt id: %d\n", codec->pix_fmt);
+ codec->pix_fmt = AV_PIX_FMT_NONE;
+ goto fail;
+ }
codec->qmin = avio_r8(pb);
codec->qmax = avio_r8(pb);
codec->max_qdiff = avio_r8(pb);
More information about the ffmpeg-cvslog
mailing list