mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
flacdec: Check for an inline header before calling metadata_parse().
Originally committed as revision 17795 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
239b961fbf
commit
55a727383b
@ -224,14 +224,13 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
|
|||||||
* the fLaC marker.
|
* the fLaC marker.
|
||||||
* @param s the flac decoding context containing the gb bit reader used to
|
* @param s the flac decoding context containing the gb bit reader used to
|
||||||
* parse metadata
|
* parse metadata
|
||||||
* @return 1 if some metadata was read, 0 if no fLaC marker was found
|
* @return non-zero if metadata is invalid
|
||||||
*/
|
*/
|
||||||
static int metadata_parse(FLACContext *s)
|
static int metadata_parse(FLACContext *s)
|
||||||
{
|
{
|
||||||
int i, metadata_last, metadata_type, metadata_size;
|
int i, metadata_last, metadata_type, metadata_size;
|
||||||
int initial_pos= get_bits_count(&s->gb);
|
int initial_pos= get_bits_count(&s->gb);
|
||||||
|
|
||||||
if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) {
|
|
||||||
skip_bits_long(&s->gb, 32);
|
skip_bits_long(&s->gb, 32);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -260,8 +259,6 @@ static int metadata_parse(FLACContext *s)
|
|||||||
}
|
}
|
||||||
} while (!metadata_last);
|
} while (!metadata_last);
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,8 +639,14 @@ static int flac_decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
init_get_bits(&s->gb, buf, buf_size*8);
|
init_get_bits(&s->gb, buf, buf_size*8);
|
||||||
|
|
||||||
if (metadata_parse(s))
|
/* check for inline header */
|
||||||
|
if (show_bits_long(&s->gb, 32) == MKBETAG('f','L','a','C')) {
|
||||||
|
if (metadata_parse(s)) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
goto end;
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
tmp = show_bits(&s->gb, 16);
|
tmp = show_bits(&s->gb, 16);
|
||||||
if ((tmp & 0xFFFE) != 0xFFF8) {
|
if ((tmp & 0xFFFE) != 0xFFF8) {
|
||||||
|
Loading…
Reference in New Issue
Block a user