diff options
author | Claudio Freire <klaussfreire@gmail.com> | 2016-03-30 18:34:08 -0300 |
---|---|---|
committer | Claudio Freire <klaussfreire@gmail.com> | 2016-03-30 22:35:28 -0300 |
commit | be746ae4706302a100cc9e53f93fa6167215a674 (patch) | |
tree | b8c02b9622c5ba3d10800458b07b9ef8765a947e | |
parent | 9bf3d01d91479f78a0c3f02a706fa4dcc52617d3 (diff) | |
download | ffmpeg-be746ae4706302a100cc9e53f93fa6167215a674.tar.gz |
AAC encoder: fix undefined behavior
Fix uninitialized access of minsf in short windows
Fix potential invocation of coef2minsf(0)
-rw-r--r-- | libavcodec/aaccoder_twoloop.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h index 4747c797d3..41d3ffd8a0 100644 --- a/libavcodec/aaccoder_twoloop.h +++ b/libavcodec/aaccoder_twoloop.h @@ -300,8 +300,12 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, start = w*128; for (g = 0; g < sce->ics.num_swb; g++) { const float *scaled = s->scoefs + start; + int minsfidx; maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled); - minsf[w*16+g] = coef2minsf(maxvals[w*16+g]); + if (maxvals[w*16+g] > 0) + minsfidx = coef2minsf(maxvals[w*16+g]); + for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) + minsf[(w+w2)*16+g] = minsfidx; start += sce->ics.swb_sizes[g]; } } |