From 930ffd46e1e742674aa7cc1c2450020c63b5015b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 30 Oct 2014 00:52:04 +0000 Subject: [PATCH] aacsbr: change order of operation to prevent out of array read CC: libav-stable@libav.org Bug-Id: CID 732250 --- libavcodec/aacsbr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 0363aff2aa..76c1014cce 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -549,7 +549,8 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) k = sbr->n_master; } while (sb != sbr->kx[1] + sbr->m[1]); - if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1) + if (sbr->num_patches > 1 && + sbr->patch_num_subbands[sbr->num_patches - 1] < 3) sbr->num_patches--; return 0;