summaryrefslogtreecommitdiff
path: root/libavcodec/truemotion2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-23 04:41:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-23 05:24:08 +0100
commite49c2aab80cb7e6c85642cc4afd0ea471d6ef4b1 (patch)
treeceb5ca239dd5f6c075103aa7ff55e9b8aace1ba4 /libavcodec/truemotion2.c
parentb89815f5199fd5e9a2d21417f827bf7c57244e84 (diff)
truemotion2: clear the token array if its initialization fails.
Fixes use of uninitialized and half initialized values, which can occur on several error pathes Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/truemotion2.c')
-rw-r--r--libavcodec/truemotion2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index fba02f5a04..39091dc70a 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -888,6 +888,8 @@ static int decode_frame(AVCodecContext *avctx,
t = tm2_read_stream(l, l->buffer + offset, tm2_stream_order[i],
buf_size - offset);
if (t < 0) {
+ int j = tm2_stream_order[i];
+ memset(l->tokens[j], 0, sizeof(**l->tokens) * l->tok_lens[j]);
return t;
}
offset += t;