diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-11 01:22:22 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-11 01:22:22 +0100 |
commit | a78f6b8cb98611a846a68f4bbb77e78fd5c175bf (patch) | |
tree | 45d4339cefc60f61310bd23b8d7cf7d0bf1f88b6 /libavcodec/wavpack.c | |
parent | 394d41ee30b0c4a38a8d33b65e28facfef15d465 (diff) | |
parent | f98ede7e610da644d3e5d553fc5d7102cf1ccde7 (diff) | |
download | ffmpeg-streaming-a78f6b8cb98611a846a68f4bbb77e78fd5c175bf.zip ffmpeg-streaming-a78f6b8cb98611a846a68f4bbb77e78fd5c175bf.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (38 commits)
v210enc: remove redundant check for pix_fmt
wavpack: allow user to disable CRC checking
v210enc: Use Bytestream2 functions
cafdec: Check return value of avio_seek and avoid modifying state if it fails
yop: Check return value of avio_seek and avoid modifying state if it fails
tta: Check return value of avio_seek and avoid modifying state if it fails
tmv: Check return value of avio_seek and avoid modifying state if it fails
r3d: Check return value of avio_seek and avoid modifying state if it fails
nsvdec: Check return value of avio_seek and avoid modifying state if it fails
mpc8: Check return value of avio_seek and avoid modifying state if it fails
jvdec: Check return value of avio_seek and avoid modifying state if it fails
filmstripdec: Check return value of avio_seek and avoid modifying state if it fails
ffmdec: Check return value of avio_seek and avoid modifying state if it fails
dv: Check return value of avio_seek and avoid modifying state if it fails
bink: Check return value of avio_seek and avoid modifying state if it fails
Check AVCodec.pix_fmts in avcodec_open2()
svq3: Prevent illegal reads while parsing extradata.
remove ParseContext1
vc1: use ff_parse_close
mpegvideo parser: move specific fields into private context
...
Conflicts:
libavcodec/4xm.c
libavcodec/aacdec.c
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c
libavcodec/mpeg4video_parser.c
libavcodec/svq3.c
libavcodec/v210enc.c
libavformat/cafdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/wavpack.c')
-rw-r--r-- | libavcodec/wavpack.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index 11c90b7..c24de45 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -499,6 +499,21 @@ static void wv_reset_saved_context(WavpackFrameContext *s) s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF; } +static inline int wv_check_crc(WavpackFrameContext *s, uint32_t crc, + uint32_t crc_extra_bits) +{ + if (crc != s->CRC) { + av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); + return AVERROR_INVALIDDATA; + } + if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) { + av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n"); + return AVERROR_INVALIDDATA; + } + + return 0; +} + static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, void *dst, const int type) { @@ -609,14 +624,9 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, GetBitContext *gb, } while (!last && count < s->samples); wv_reset_saved_context(s); - if (crc != s->CRC) { - av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); - return -1; - } - if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) { - av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n"); - return -1; - } + if ((s->avctx->err_recognition & AV_EF_CRCCHECK) && + wv_check_crc(s, crc, crc_extra_bits)) + return AVERROR_INVALIDDATA; return count * 2; } @@ -679,14 +689,9 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, GetBitContext *gb, } while (!last && count < s->samples); wv_reset_saved_context(s); - if (crc != s->CRC) { - av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); - return -1; - } - if (s->got_extra_bits && crc_extra_bits != s->crc_extra_bits) { - av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n"); - return -1; - } + if ((s->avctx->err_recognition & AV_EF_CRCCHECK) && + wv_check_crc(s, crc, crc_extra_bits)) + return AVERROR_INVALIDDATA; return count; } |