Browse code

wv: make probing more robust

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2013/05/15 06:03:09
Showing 1 changed files
... ...
@@ -73,8 +73,11 @@ static int wv_probe(AVProbeData *p)
73 73
     /* check file header */
74 74
     if (p->buf_size <= 32)
75 75
         return 0;
76
-    if (p->buf[0] == 'w' && p->buf[1] == 'v' &&
77
-        p->buf[2] == 'p' && p->buf[3] == 'k')
76
+    if (AV_RL32(&p->buf[0]) == MKTAG('w', 'v', 'p', 'k') &&
77
+        AV_RL32(&p->buf[4]) >= 24 &&
78
+        AV_RL32(&p->buf[4]) <= WV_BLOCK_LIMIT &&
79
+        AV_RL16(&p->buf[8]) >= 0x402 &&
80
+        AV_RL16(&p->buf[8]) <= 0x410)
78 81
         return AVPROBE_SCORE_MAX;
79 82
     else
80 83
         return 0;