comparison raw.c @ 4292:0e275ee37217 libavformat

Check buffer is inside what is passed when probing for flac.
author benoit
date Tue, 27 Jan 2009 18:00:40 +0000
parents d8803d0a4274
children 491a0b1d4f62
comparison
equal deleted inserted replaced
4291:f49e5d92ab26 4292:0e275ee37217
584 584
585 #if CONFIG_FLAC_DEMUXER 585 #if CONFIG_FLAC_DEMUXER
586 static int flac_probe(AVProbeData *p) 586 static int flac_probe(AVProbeData *p)
587 { 587 {
588 uint8_t *bufptr = p->buf; 588 uint8_t *bufptr = p->buf;
589 uint8_t *end = p->buf + p->buf_size;
589 590
590 if(ff_id3v2_match(bufptr)) 591 if(ff_id3v2_match(bufptr))
591 bufptr += ff_id3v2_tag_len(bufptr); 592 bufptr += ff_id3v2_tag_len(bufptr);
592 593
593 if(memcmp(bufptr, "fLaC", 4)) return 0; 594 if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
594 else return AVPROBE_SCORE_MAX / 2; 595 else return AVPROBE_SCORE_MAX / 2;
595 } 596 }
596 #endif 597 #endif
597 598
598 #if CONFIG_AAC_DEMUXER 599 #if CONFIG_AAC_DEMUXER