[FFmpeg-devel] [PATCH] dca: don't fail decoding on invalid core frame size unless explode is set

Hendrik Leppkes h.leppkes at gmail.com
Sat Jan 30 11:39:38 CET 2016

 libavcodec/dca_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Since I want to get this forward and foo86 unfortunately hasn't responded yet,
this patch fixes decoding of Michael's sample and should generally be safe,
since it just checks after-the-fact (and we use the safe bitstream reader

Maybe the log should be a warning of explode is not set, but it looked kinda ugly
to do that in the code, opinions welcome. :p

diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 61f7ff3..5fbc908 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -1977,7 +1977,8 @@ int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
     if (ff_dca_seek_bits(&s->gb, s->frame_size * 8)) {
         av_log(s->avctx, AV_LOG_ERROR, "Read past end of core frame\n");
-        return AVERROR_INVALIDDATA;
+        if (avctx->err_recognition & AV_EF_EXPLODE)
+            return AVERROR_INVALIDDATA;
     return 0;

More information about the ffmpeg-devel mailing list