diff options
author | Michael Chinen <mchinen@gmail.com> | 2010-12-07 13:42:52 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2010-12-07 13:42:52 +0000 |
commit | 7f4e432148779b338a6199f50eb70845c78fd060 (patch) | |
tree | 6d89b467fa9bffbca2fbe406e442fa39bc887db6 | |
parent | 625daac4bddda7858d16869c90ba7df95e7702c6 (diff) | |
download | ffmpeg-7f4e432148779b338a6199f50eb70845c78fd060.tar.gz |
Check validity of the frame sync code in ff_flac_decode_frame_header().
Patch by Michael Chinen [mchinen at gmail]
Originally committed as revision 25910 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/flac.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c index f6b65ce5e9..2e3197f483 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -38,7 +38,13 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, int bs_code, sr_code, bps_code; /* frame sync code */ - skip_bits(gb, 16); + if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) { + av_log(avctx, AV_LOG_ERROR, "invalid sync code\n"); + return -1; + } + + /* variable block size stream code */ + skip_bits1(gb); /* block size and sample rate codes */ bs_code = get_bits(gb, 4); |