[FFmpeg-cvslog] avcodec/aacenc: Tighter input checks
Michael Niedermayer
git at videolan.org
Mon Sep 5 02:24:48 EEST 2016
ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Tue Aug 23 11:00:29 2016 +0200| [cd91aaa4cc59bca6d05e30a0b044cd95df26a26f] | committer: Michael Niedermayer
avcodec/aacenc: Tighter input checks
Fixes occurance of NaN/Inf leading to assertion failures and out of array access
Fixes: d1c38a09acc34845c6be3a127a5aacaf/signal_sigsegv_3982225_6121_d18bd5451d4245ee09408f04badd1b83.wmv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 77bf96b04710b98a52aaddb93bfd32da0d506191)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd91aaa4cc59bca6d05e30a0b044cd95df26a26f
---
libavcodec/aacenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 5a70da1..51b90e9 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -609,8 +609,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
}
for (k = 0; k < 1024; k++) {
- if (!isfinite(cpe->ch[ch].coeffs[k])) {
- av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
+ if (!(fabs(cpe->ch[ch].coeffs[k]) < 1E16)) { // Ensure headroom for energy calculation
+ av_log(avctx, AV_LOG_ERROR, "Input contains (near) NaN/+-Inf\n");
return AVERROR(EINVAL);
}
}
More information about the ffmpeg-cvslog
mailing list