aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-11 02:04:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-11 02:04:01 +0100
commit6b18a6839b43ea78e70cd3e35f781d1c955bda73 (patch)
tree7ebc0431cf366f41f2881f0d45dd84ef9fafa4ca /libavcodec
parentae3856dcaf9c5ef339969c95a72bcaf7c4bba9ec (diff)
downloadffmpeg-6b18a6839b43ea78e70cd3e35f781d1c955bda73.tar.gz
avcodec/wmalosslessdec: shrink output on error so no uninitialized data is returned
Fixes use of uninitialized memory partly fixes: msan_uninit-mem_7f7834b6a530_6473_luckynight-partial.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wmalosslessdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 8a08f5a6d4..4cf7f54143 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1076,8 +1076,11 @@ static int decode_frame(WmallDecodeCtx *s)
/* decode all subframes */
while (!s->parsed_all_subframes) {
+ int decoded_samples = s->channel[0].decoded_samples;
if (decode_subframe(s) < 0) {
s->packet_loss = 1;
+ if (s->frame->nb_samples)
+ s->frame->nb_samples = decoded_samples;
return 0;
}
}