Browse code

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>

Michael Niedermayer authored on 2014/09/07 20:00:47
Showing 1 changed files
... ...
@@ -1368,6 +1368,9 @@ int ff_MPV_common_frame_size_change(MpegEncContext *s)
1368 1368
 {
1369 1369
     int i, err = 0;
1370 1370
 
1371
+    if (!s->context_initialized)
1372
+        return AVERROR(EINVAL);
1373
+
1371 1374
     if (s->slice_context_count > 1) {
1372 1375
         for (i = 0; i < s->slice_context_count; i++) {
1373 1376
             free_duplicate_context(s->thread_context[i]);