summaryrefslogtreecommitdiff
path: root/libavcodec/alsdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-28 23:53:24 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-29 12:35:57 +0100
commit5c74fa6ce0205c341afb76f6adf2b73c88ff26ef (patch)
treea4d5ca5d700bd4bf1ef4eb79e7a0e9ee5e7625ad /libavcodec/alsdec.c
parent74a9c92840d3494393938874c1cdd5bdb95cc918 (diff)
avcodec/alsdec: skip cases where the master channel equals the current channel
Fixes: msan_uninit-mem_7f6c73c97cf9_3571_als_04_2ch48k16b.mp4 Fixes use of uninitialized memory Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/alsdec.c')
-rw-r--r--libavcodec/alsdec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index f554eaa5a9..c42b2aee19 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1263,14 +1263,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
bd->quant_cof = ctx->quant_cof[c];
bd->raw_samples = ctx->raw_samples[c] + offset;
- dep = 0;
- while (!ch[dep].stop_flag) {
+ for (dep = 0; !ch[dep].stop_flag; dep++) {
unsigned int smp;
unsigned int begin = 1;
unsigned int end = bd->block_length - 1;
int64_t y;
int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
+ if (ch[dep].master_channel == c)
+ continue;
+
if (ch[dep].time_diff_flag) {
int t = ch[dep].time_diff_index;
@@ -1302,8 +1304,6 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
bd->raw_samples[smp] += y >> 7;
}
}
-
- dep++;
}
return 0;