aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-07 13:00:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-07 15:33:06 +0200
commit0f1882b9b2e443ed13f7dde4ec7487916d14e8ad (patch)
tree5093bc510a08e920b122ec2e951c88817f0bf9c3
parent0fc229450fd965d6fea86a95d1b7afec5d26e328 (diff)
downloadffmpeg-0f1882b9b2e443ed13f7dde4ec7487916d14e8ad.tar.gz
avcodec/mpegvideo: check that the context is initialized in ff_mpv_common_frame_size_change()
The function otherwise would initialize the context without setting context_initialized alternatively we could set context_initialized Fixes valgrind anomalies related to ticket 3928 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 0d0f7f0ba43f64312ae4a05d97afecf1b7b1330c) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpegvideo.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 11e5467b3d..5dab8d8cbb 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1086,6 +1086,9 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
{
int i, err = 0;
+ if (!s->context_initialized)
+ return AVERROR(EINVAL);
+
if (s->slice_context_count > 1) {
for (i = 0; i < s->slice_context_count; i++) {
free_duplicate_context(s->thread_context[i]);