History

lavf/flacdec: Return maximum score if the streaminfo header is valid.

Carl Eugen Hoyos committed 9 years ago

Commit 37330391 parent 4bed0661 file · +8 −1Browse files

Unified · Split

libavformat/flacdec.c+8−1
@@ -233,7 +233,14 @@ static int flac_probe(AVProbeData *p) · 232 unmodified lines
233233 return raw_flac_probe(p);
234234 if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4))
235235 return 0;
236− return AVPROBE_SCORE_EXTENSION;
236+ if ( p->buf[4] & 0x7f != FLAC_METADATA_TYPE_STREAMINFO
237+ || AV_RB24(p->buf + 5) != FLAC_STREAMINFO_SIZE
238+ || AV_RB16(p->buf + 8) < 16
239+ || AV_RB16(p->buf + 8) > AV_RB16(p->buf + 10)
240+ || !(AV_RB24(p->buf + 18) >> 4)
241+ || AV_RB24(p->buf + 18) >> 4 > 655350)
242+ return AVPROBE_SCORE_EXTENSION;
243+ return AVPROBE_SCORE_MAX;
237244 }
238245
239246 static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t