[FFmpeg-cvslog] libavformat/mtv: Check for min header size first
Reynaldo H. Verdejo Pinochet
git at videolan.org
Thu Jan 23 21:41:31 CET 2014
ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com> | Thu Jan 23 15:43:07 2014 -0300| [30f4c58f6f92765b3d06b0950392e5264630bce0] | committer: Reynaldo H. Verdejo Pinochet
libavformat/mtv: Check for min header size first
Abort immediately if we are not getting enough
data to extract the required fields.
Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30f4c58f6f92765b3d06b0950392e5264630bce0
---
libavformat/mtv.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index 0517dd2..5e638ca 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -52,12 +52,18 @@ typedef struct MTVDemuxContext {
static int mtv_probe(AVProbeData *p)
{
+ /* we need at least 57 bytes from the header
+ * to try parsing all required fields
+ */
+ if (p->buf_size < 57)
+ return 0;
+
/* Magic is 'AMV' */
if (*p->buf != 'A' || *(p->buf + 1) != 'M' || *(p->buf + 2) != 'V')
return 0;
/* Check for nonzero in bpp and (width|height) header fields */
- if(p->buf_size < 57 || !(p->buf[51] && AV_RL16(&p->buf[52]) | AV_RL16(&p->buf[54])))
+ if(!(p->buf[51] && AV_RL16(&p->buf[52]) | AV_RL16(&p->buf[54])))
return 0;
/* If width or height are 0 then imagesize header field should not */
More information about the ffmpeg-cvslog
mailing list