[FFmpeg-devel] [PATCH] avcodec/flac: check frame header crc only if requested
James Almer
jamrial at gmail.com
Thu Dec 8 05:33:56 EET 2016
It's more consistent with other similar checks in the decoder, and should
help with fuzzing.
Signed-off-by: James Almer <jamrial at gmail.com>
---
I could also add an AV_EF_EXPLODE check before aborting, but i figured
that with a frame header crc failure it's pretty much guaranteed the
file will be unplayable.
libavcodec/flac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 5ffbf93..8e1b059 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -135,7 +135,8 @@ int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
/* header CRC-8 check */
skip_bits(gb, 8);
- if (av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, gb->buffer,
+ if ((avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_COMPLIANT)) &&
+ av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, gb->buffer,
get_bits_count(gb)/8)) {
av_log(avctx, AV_LOG_ERROR + log_level_offset,
"header crc mismatch\n");
--
2.10.2
More information about the ffmpeg-devel
mailing list