summaryrefslogtreecommitdiff
path: root/libavformat/yop.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-31 14:47:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-31 14:47:15 +0200
commit76170f537304cc845d6d334d36daa0a0f16efb32 (patch)
treef8321c8f1294fcff10ea5074ed51e0f82eb9f980 /libavformat/yop.c
parent60de7616575cfea3e01bb19ff476a97a8ab8da3b (diff)
yop_probe: check more fields to avoid detecting random data as yop
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/yop.c')
-rw-r--r--libavformat/yop.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/yop.c b/libavformat/yop.c
index e8f4e8e6ab..c7d3f65192 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -38,10 +38,15 @@ typedef struct yop_dec_context {
static int yop_probe(AVProbeData *probe_packet)
{
if (AV_RB16(probe_packet->buf) == AV_RB16("YO") &&
+ probe_packet->buf[2]<10 &&
+ probe_packet->buf[3]<10 &&
probe_packet->buf[6] &&
probe_packet->buf[7] &&
!(probe_packet->buf[8] & 1) &&
- !(probe_packet->buf[10] & 1))
+ !(probe_packet->buf[10] & 1) &&
+ AV_RL16(probe_packet->buf + 12 + 6) >= 920 &&
+ AV_RL16(probe_packet->buf + 12 + 6) < probe_packet->buf[12] * 3 + 4 + probe_packet->buf[7] * 2048
+ )
return AVPROBE_SCORE_MAX * 3 / 4;
return 0;