diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 21:27:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-05 01:47:57 +0200 |
commit | 2cebde69e031b638f3439dfce4c729424aa294ca (patch) | |
tree | ca074ec08304e29c1a691159a5219f43f47a1498 | |
parent | 9fd30d0bdf5ccfebd7c0409fdf7d9d133d4642fb (diff) | |
download | ffmpeg-2cebde69e031b638f3439dfce4c729424aa294ca.tar.gz |
avcodec/dstdec: Replace AC overread check by sample rate check
Real files do skip coding 0 bits at the end, thus this kind of check
does not work reliable.
Fixes: Ticket 8770
Fixes: dst-256fs44-6ch-refdstencoder.dff
The samplerate is specified in ISO/IEC 14496-3:2005(E) as one of 3 fixed
values, this also can be used to limit the duration and avoid the timeout
This reverts commit f6df99dba1ae64b05d08fba8160d13eb9795042f.
(cherry picked from commit 1679f23beb3cfc3639352b3cbe7c08c00189c6b0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dstdec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c index a38360fb95..ebba6cc2c9 100644 --- a/libavcodec/dstdec.c +++ b/libavcodec/dstdec.c @@ -85,6 +85,12 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_PATCHWELCOME; } + // the sample rate is only allowed to be 64,128,256 * 44100 by ISO/IEC 14496-3:2005(E) + // We are a bit more tolerant here, but this check is needed to bound the size and duration + if (avctx->sample_rate > 512 * 44100) + return AVERROR_INVALIDDATA; + + if (DST_SAMPLES_PER_FRAME(avctx->sample_rate) & 7) { return AVERROR_PATCHWELCOME; } |