Revision 5837e4ca libavformat/mm.c

View differences:

libavformat/mm.c
58 58

  
59 59
static int mm_probe(AVProbeData *p)
60 60
{
61
    int len, type, fps, w, h;
62
    if (p->buf_size < MM_HEADER_LEN_AV + MM_PREAMBLE_SIZE)
63
        return 0;
61 64
    /* the first chunk is always the header */
62 65
    if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER)
63 66
        return 0;
64
    if (AV_RL32(&p->buf[2]) != MM_HEADER_LEN_V && AV_RL32(&p->buf[2]) != MM_HEADER_LEN_AV)
67
    len = AV_RL32(&p->buf[2]);
68
    if (len != MM_HEADER_LEN_V && len != MM_HEADER_LEN_AV)
69
        return 0;
70
    fps = AV_RL16(&p->buf[8]);
71
    w = AV_RL16(&p->buf[12]);
72
    h = AV_RL16(&p->buf[14]);
73
    if (!fps || fps > 60 || !w || w > 2048 || !h || h > 2048)
74
        return 0;
75
    type = AV_RL16(&p->buf[len]);
76
    if (!type || type > 0x31)
65 77
        return 0;
66 78

  
67 79
    /* only return half certainty since this check is a bit sketchy */

Also available in: Unified diff