aacsbr: change order of operation to prevent out of array read
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Oct 2012 22:10:23 +0000 (00:10 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Oct 2012 22:31:21 +0000 (00:31 +0200)
Fixes CID732250
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/aacsbr.c

index b4fc761..db0954b 100644 (file)
@@ -555,7 +555,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
             k = sbr->n_master;
     } while (sb != sbr->kx[1] + sbr->m[1]);
 
             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;
         sbr->num_patches--;
 
     return 0;