1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2016-08-23 11:00:29 +02:00
parent 76d377d0a0
commit 77bf96b047

View File

@ -622,8 +622,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
for (k = 0; k < 1024; k++) { for (k = 0; k < 1024; k++) {
if (!isfinite(cpe->ch[ch].coeffs[k])) { if (!(fabs(cpe->ch[ch].coeffs[k]) < 1E16)) { // Ensure headroom for energy calculation
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n"); av_log(avctx, AV_LOG_ERROR, "Input contains (near) NaN/+-Inf\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
} }