aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dsp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-02 02:02:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-02 02:24:09 +0100
commit4c677df27cc62e5dd8df9da9d0ca9fb7d963bc08 (patch)
tree1453699ac3b21c5c25889aaed590ca4bc0c7a755 /libavcodec/ac3dsp.c
parent5cd8afee99c83b62e1474f122d947de7e4ad9ff5 (diff)
parent5ff88020ac4cd285fa00d0c559aa196bbd8526d7 (diff)
downloadffmpeg-4c677df27cc62e5dd8df9da9d0ca9fb7d963bc08.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) frwu: Employ more meaningful return values. fraps: Use av_fast_padded_malloc() instead of av_realloc() mjpegdec: use av_fast_padded_malloc() eatqi: use av_fast_padded_malloc() asv1: use av_fast_padded_malloc() avcodec: Add av_fast_padded_malloc(). swscale: enable dithering in MMX functions. swscale: make rgb24 function macros slightly smaller. avcodec.h: Remove some disabled cruft. swscale: remove obsolete comment. swscale-test: Drop unused argc and argv arguments from main(). zmbv: Employ more meaningful return values. zmbvenc: Employ more meaningful return values. vc1: prevent null pointer dereference on broken files zmbv: check av_realloc() return values and avoid memleaks on ENOMEM truespeech: align buffer ac3: Do not read past the end of ff_ac3_band_start_tab. dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936. dv: Fix null pointer dereference due to ach=0 dv: check stype ... Conflicts: doc/APIchanges libavcodec/asv1.c libavcodec/avcodec.h libavcodec/eatqi.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/zmbv.c libavformat/dv.c libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3dsp.c')
-rw-r--r--libavcodec/ac3dsp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index a414db4107..581e5f5071 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -109,7 +109,7 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
int snr_offset, int floor,
const uint8_t *bap_tab, uint8_t *bap)
{
- int bin, band;
+ int bin, band, band_end;
/* special case, if snr offset is -960, set all bap's to zero */
if (snr_offset == -960) {
@@ -121,12 +121,14 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
band = ff_ac3_bin_to_band_tab[start];
do {
int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
- int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end);
+ band_end = ff_ac3_band_start_tab[++band];
+ band_end = FFMIN(band_end, end);
+
for (; bin < band_end; bin++) {
int address = av_clip((psd[bin] - m) >> 5, 0, 63);
bap[bin] = bap_tab[address];
}
- } while (end > ff_ac3_band_start_tab[band++]);
+ } while (end > band_end);
}
static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,