Commit 92465a23 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/aacenc: Check for +-Inf too

Fixes out of array read
Fixes: 04442da73d935b776d2236282588d4f9/signal_sigsegv_2625a69_8790_ae85ffc889070663319b3417ede777b0.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 17e7fdf6
...@@ -606,16 +606,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -606,16 +606,16 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf); s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf);
} }
if (isnan(cpe->ch->coeffs[0]) || if (isnan(cpe->ch->coeffs[ 0]) || isinf(cpe->ch->coeffs[ 0]) ||
isnan(cpe->ch->coeffs[ 128]) || isnan(cpe->ch->coeffs[ 128]) || isinf(cpe->ch->coeffs[ 128]) ||
isnan(cpe->ch->coeffs[2*128]) || isnan(cpe->ch->coeffs[2*128]) || isinf(cpe->ch->coeffs[2*128]) ||
isnan(cpe->ch->coeffs[3*128]) || isnan(cpe->ch->coeffs[3*128]) || isinf(cpe->ch->coeffs[3*128]) ||
isnan(cpe->ch->coeffs[4*128]) || isnan(cpe->ch->coeffs[4*128]) || isinf(cpe->ch->coeffs[4*128]) ||
isnan(cpe->ch->coeffs[5*128]) || isnan(cpe->ch->coeffs[5*128]) || isinf(cpe->ch->coeffs[5*128]) ||
isnan(cpe->ch->coeffs[6*128]) || isnan(cpe->ch->coeffs[6*128]) || isinf(cpe->ch->coeffs[6*128]) ||
isnan(cpe->ch->coeffs[7*128]) isnan(cpe->ch->coeffs[7*128]) || isinf(cpe->ch->coeffs[7*128])
) { ) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN\n"); av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
avoid_clipping(s, sce); avoid_clipping(s, sce);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment