Unified · Split
| @@ -233,7 +233,14 @@ static int flac_probe(AVProbeData *p) · 232 unmodified lines | ||
| 233 | 233 | return raw_flac_probe(p); |
| 234 | 234 | if (p->buf_size < 4 || memcmp(p->buf, "fLaC", 4)) |
| 235 | 235 | 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; | |
| 237 | 244 | } |
| 238 | 245 | |
| 239 | 246 | static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, |