aboutsummaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer2016-08-23 11:00:29 +0200
committerMichael Niedermayer2016-08-23 11:03:00 +0200
commit77bf96b04710b98a52aaddb93bfd32da0d506191 (patch)
tree6597dccdf119fc5f4f5607c2cd003e4f250a8fd4 /libavcodec
parent76d377d0a0a85f79dbe461971014e13b56937c86 (diff)
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@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/aacenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index e1a2d4544b..9e421a9aaa 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -622,8 +622,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);
}
}