aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/shorten.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-12 22:19:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-12 22:19:40 +0100
commitf9c9ee445f7cb46be1550fdf809626b997f814ac (patch)
tree0048c563f1ee8b60fdc3cfd8611c4c550817e551 /libavcodec/shorten.c
parentc0cbf3af0188d06a11c74b3ab2402de1c248a76b (diff)
parent8935e7474ada9f18e9c21ec3a0a1706040e7b3be (diff)
downloadffmpeg-f9c9ee445f7cb46be1550fdf809626b997f814ac.tar.gz
Merge branch 'release/0.8' into release/0.7
* release/0.8: shorten: Fix invalid free() j2kdec: Fix crash in get_qcx j2kdec: Check curtileno for validity atrac3: Fix crash in tonal component decoding. Fixes Ticket780 Bug Found by: cosminamironesei h264: check chroma_format_idc range. Fixes Ticket758 Bug found by: Diana Elena Muscalu aacsbr: Fix memory corruption. Fixes Ticket760 and Ticket761 Bug Found by: Diana Elena Muscalu j2kdec: Fix integer overflow leading to a segfault Fixes Ticket776 Bug found by: Diana Elena Muscalu ws_snd1: Fix wrong samples count and crash. lavfi: add missing check in avfilter_filter_samples() Update Changelog for 0.7.4 release Update RELEASE file for 0.7.4 swscale: fix crash in fast_bilinear code when compiled with -mred-zone. vorbis: An additional defense in the Vorbis codec. vorbisdec: Fix decoding bug with channel handling Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/shorten.c')
-rw-r--r--libavcodec/shorten.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 0b9d420d86..621281fc75 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -81,6 +81,7 @@ typedef struct ShortenContext {
int channels;
int32_t *decoded[MAX_CHANNELS];
+ int32_t *decoded_base[MAX_CHANNELS];
int32_t *offset[MAX_CHANNELS];
int *coeffs;
uint8_t *bitstream;
@@ -130,13 +131,13 @@ static int allocate_buffers(ShortenContext *s)
return AVERROR(ENOMEM);
s->offset[chan] = tmp_ptr;
- tmp_ptr = av_realloc(s->decoded[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
+ tmp_ptr = av_realloc(s->decoded_base[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
if (!tmp_ptr)
return AVERROR(ENOMEM);
- s->decoded[chan] = tmp_ptr;
+ s->decoded_base[chan] = tmp_ptr;
for (i=0; i<s->nwrap; i++)
- s->decoded[chan][i] = 0;
- s->decoded[chan] += s->nwrap;
+ s->decoded_base[chan][i] = 0;
+ s->decoded[chan] = s->decoded_base[chan] + s->nwrap;
}
coeffs = av_realloc(s->coeffs, s->nwrap * sizeof(*s->coeffs));
@@ -548,8 +549,8 @@ static av_cold int shorten_decode_close(AVCodecContext *avctx)
int i;
for (i = 0; i < s->channels; i++) {
- s->decoded[i] -= s->nwrap;
- av_freep(&s->decoded[i]);
+ s->decoded[i] = NULL;
+ av_freep(&s->decoded_base[i]);
av_freep(&s->offset[i]);
}
av_freep(&s->bitstream);