aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-06 21:35:08 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-12-17 20:03:29 +0100
commitdcd837e41c83c6eac52d64b8d8f6a96aacf674cb (patch)
tree620a296bcbaf3cea72a2fc6e2a32d5f653c38f14
parent507e0314c0d9107f6e17753950f9aceb6ed3b8d5 (diff)
downloadffmpeg-dcd837e41c83c6eac52d64b8d8f6a96aacf674cb.tar.gz
aacenc: update max_sfb when num_swb changes
This fixes out-of-bounds reads in avoid_clipping. Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> (cherry picked from commit 5b0da6999fdd0135b6f269d3691d74720f773c85) Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r--libavcodec/aacenc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 9cce1a2ff0..a7c73369c8 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -547,6 +547,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
ics->num_windows = wi[ch].num_windows;
ics->swb_sizes = s->psy.bands [ics->num_windows == 8];
ics->num_swb = tag == TYPE_LFE ? ics->num_swb : s->psy.num_bands[ics->num_windows == 8];
+ ics->max_sfb = FFMIN(ics->max_sfb, ics->num_swb);
ics->swb_offset = wi[ch].window_type[0] == EIGHT_SHORT_SEQUENCE ?
ff_swb_offset_128 [s->samplerate_index]:
ff_swb_offset_1024[s->samplerate_index];