[FFmpeg-devel] [PATCH 1/4] lavc/options: fix shallow copy context

Lukasz Marek lukasz.m.luki2 at gmail.com
Sat Nov 8 18:13:50 CET 2014


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 at gmail.com>
---
 libavcodec/options.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index c4ee234..461e4a1 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -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;
 
-- 
1.9.1



More information about the ffmpeg-devel mailing list