[FFmpeg-cvslog] avformat/smacker: check width/height in probe

Michael Niedermayer git at videolan.org
Tue Nov 12 21:21:18 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov 12 19:37:37 2013 +0100| [0062869ae25007c8506517dcfcbe6f439dc6958a] | committer: Michael Niedermayer

avformat/smacker: check width/height in probe

Fixes probetest failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0062869ae25007c8506517dcfcbe6f439dc6958a
---

 libavformat/smacker.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 527faf7..0d38588 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -92,11 +92,14 @@ static const uint8_t smk_pal[64] = {
 
 static int smacker_probe(AVProbeData *p)
 {
-    if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'
-        && (p->buf[3] == '2' || p->buf[3] == '4'))
-        return AVPROBE_SCORE_MAX;
-    else
+    if (   AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '2')
+        && AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '4'))
         return 0;
+
+    if (AV_RL32(p->buf+4) > 32768U || AV_RL32(p->buf+8) > 32768U)
+        return AVPROBE_SCORE_MAX/4;
+
+    return AVPROBE_SCORE_MAX;
 }
 
 static int smacker_read_header(AVFormatContext *s)



More information about the ffmpeg-cvslog mailing list