aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-14 21:50:23 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-09-14 21:50:23 +0000
commit98487a5b69d9641b4ed66a5281752ea5617eeac7 (patch)
tree03e8ded92226c4dbe78350439be299e645b2b0d5
parent9ecc414195f4ef931e9dcfb9e6017fb7d757f124 (diff)
downloadffmpeg-98487a5b69d9641b4ed66a5281752ea5617eeac7.tar.gz
Make dnxhd probe more strict, fail if we detect values in header that would
make our decoder fail anyway. dnxhd probe now passes probetest. Originally committed as revision 19847 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/raw.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c
index a3227cd453..3a53eee527 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -580,10 +580,19 @@ static int dirac_probe(AVProbeData *p)
static int dnxhd_probe(AVProbeData *p)
{
static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
- if (!memcmp(p->buf, header, 5))
- return AVPROBE_SCORE_MAX;
- else
+ int w, h, compression_id;
+ if (p->buf_size < 0x2c)
+ return 0;
+ if (memcmp(p->buf, header, 5))
+ return 0;
+ h = AV_RB16(p->buf + 0x18);
+ w = AV_RB16(p->buf + 0x1a);
+ if (!w || !h)
+ return 0;
+ compression_id = AV_RB32(p->buf + 0x28);
+ if (compression_id < 1237 || compression_id > 1253)
return 0;
+ return AVPROBE_SCORE_MAX;
}
#endif