lavc/options: fix shallow copy context
authorLukasz Marek <lukasz.m.luki2@gmail.com>
Sat, 8 Nov 2014 16:01:40 +0000 (17:01 +0100)
committerLukasz Marek <lukasz.m.luki2@gmail.com>
Sun, 9 Nov 2014 16:56:08 +0000 (17:56 +0100)
avcodec_copy_context leaves shallow copy of string/binary/dict options.
Double free/accessing freed memory may occur.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
libavcodec/options.c

index c4ee234..461e4a1 100644 (file)
@@ -187,6 +187,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
     av_opt_free(dest);
 
     memcpy(dest, src, sizeof(*dest));
+    av_opt_copy(dest, src);
 
     dest->priv_data       = orig_priv_data;