comparison dxa.c @ 5216:7c0b8cd87f5a libavformat

Improve dxa probe by checking the values for width and height are reasonable.
author reimar
date Thu, 17 Sep 2009 18:08:07 +0000
parents 33a244b7ca65
children 536e5527c1e0
comparison
equal deleted inserted replaced
5215:6fc9f9d8aaa1 5216:7c0b8cd87f5a
34 int readvid; 34 int readvid;
35 }DXAContext; 35 }DXAContext;
36 36
37 static int dxa_probe(AVProbeData *p) 37 static int dxa_probe(AVProbeData *p)
38 { 38 {
39 int w, h;
40 if (p->buf_size < 15)
41 return 0;
42 w = AV_RB16(p->buf + 11);
43 h = AV_RB16(p->buf + 13);
39 /* check file header */ 44 /* check file header */
40 if (p->buf[0] == 'D' && p->buf[1] == 'E' && 45 if (p->buf[0] == 'D' && p->buf[1] == 'E' &&
41 p->buf[2] == 'X' && p->buf[3] == 'A') 46 p->buf[2] == 'X' && p->buf[3] == 'A' &&
47 w && w <= 2048 && h && h <= 2048)
42 return AVPROBE_SCORE_MAX; 48 return AVPROBE_SCORE_MAX;
43 else 49 else
44 return 0; 50 return 0;
45 } 51 }
46 52