diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2017-03-02 09:29:10 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2017-03-30 01:41:22 +0200 |
commit | 582c3d514a7b40d38fff610da2110ac63dfe2e10 (patch) | |
tree | 81d8dfc78f6213dfad432697a8ff4a68f1b95e41 /libavformat | |
parent | a60e66516233f3c84545d90d8cfd64c1cb9f0a8d (diff) | |
download | ffmpeg-582c3d514a7b40d38fff610da2110ac63dfe2e10.tar.gz |
lavf/flacdec: Return maximum score if the streaminfo header is valid.
Fixes ticket #6208.
(cherry picked from commit 3733039610d76231e404ebf089f0ff2b9d8e5490)
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/flacdec.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 66baba5922..fee46fcfe6 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -233,7 +233,14 @@ static int flac_probe(AVProbeData *p) return raw_flac_probe(p); if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4)) return 0; - return AVPROBE_SCORE_EXTENSION; + if ( p->buf[4] & 0x7f != FLAC_METADATA_TYPE_STREAMINFO + || AV_RB24(p->buf + 5) != FLAC_STREAMINFO_SIZE + || AV_RB16(p->buf + 8) < 16 + || AV_RB16(p->buf + 8) > AV_RB16(p->buf + 10) + || !(AV_RB24(p->buf + 18) >> 4) + || AV_RB24(p->buf + 18) >> 4 > 655350) + return AVPROBE_SCORE_EXTENSION; + return AVPROBE_SCORE_MAX; } static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, |