[FFmpeg-cvslog] avcodec/mpegvideo: check that the context is initialized in ff_mpv_common_frame_size_change( )
Michael Niedermayer
git at videolan.org
Fri Nov 28 20:02:22 CET 2014
ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 7 13:00:47 2014 +0200| [31f5d5f6903ce2296c773fa06da0477f8e7dbef3] | committer: Michael Niedermayer
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 at gmx.at>
(cherry picked from commit 0d0f7f0ba43f64312ae4a05d97afecf1b7b1330c)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31f5d5f6903ce2296c773fa06da0477f8e7dbef3
---
libavcodec/mpegvideo.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f3c7ea5..1fd3e52 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1184,6 +1184,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]);
More information about the ffmpeg-cvslog
mailing list