mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 16:52:31 +00:00
oma: better format detection with small probe buffer
Signed-off-by: David Goldwich <david.goldwich@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
e96070074d
commit
8ae5eb75df
@ -394,14 +394,20 @@ static int oma_read_probe(AVProbeData *p)
|
|||||||
unsigned tag_len = 0;
|
unsigned tag_len = 0;
|
||||||
|
|
||||||
buf = p->buf;
|
buf = p->buf;
|
||||||
/* version must be 3 and flags byte zero */
|
|
||||||
if (ff_id3v2_match(buf, ID3v2_EA3_MAGIC) && buf[3] == 3 && !buf[4])
|
|
||||||
tag_len = ff_id3v2_tag_len(buf);
|
|
||||||
|
|
||||||
// This check cannot overflow as tag_len has at most 28 bits
|
if (p->buf_size < ID3v2_HEADER_SIZE ||
|
||||||
if (p->buf_size < tag_len + 5)
|
!ff_id3v2_match(buf, ID3v2_EA3_MAGIC) ||
|
||||||
|
buf[3] != 3 || // version must be 3
|
||||||
|
buf[4]) // flags byte zero
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
tag_len = ff_id3v2_tag_len(buf);
|
||||||
|
|
||||||
|
/* This check cannot overflow as tag_len has at most 28 bits */
|
||||||
|
if (p->buf_size < tag_len + 5)
|
||||||
|
/* EA3 header comes late, might be outside of the probe buffer */
|
||||||
|
return AVPROBE_SCORE_MAX / 2;
|
||||||
|
|
||||||
buf += tag_len;
|
buf += tag_len;
|
||||||
|
|
||||||
if (!memcmp(buf, "EA3", 3) && !buf[4] && buf[5] == EA3_HEADER_SIZE)
|
if (!memcmp(buf, "EA3", 3) && !buf[4] && buf[5] == EA3_HEADER_SIZE)
|
||||||
|
Loading…
Reference in New Issue
Block a user