diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-12-02 23:24:15 +0100 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-12-06 00:05:18 +0100 |
commit | 53b2809f2c1b942adf4d876ac446ef97f812ac0c (patch) | |
tree | 81639ee4e7b0067a1e031104170145f7e83a3bf7 /libavcodec | |
parent | 95f719fb8f475523d29f93a7e321a6db9f837631 (diff) | |
download | ffmpeg-streaming-53b2809f2c1b942adf4d876ac446ef97f812ac0c.zip ffmpeg-streaming-53b2809f2c1b942adf4d876ac446ef97f812ac0c.tar.gz |
lavc/options: don't copy priv context when it is not AVOption object
This prevents potential crash when opt API is used without a class.
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/options.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/options.c b/libavcodec/options.c index 7f9fb07..49c8b40 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -195,11 +195,12 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) av_opt_copy(dest, src); dest->priv_data = orig_priv_data; + dest->codec = orig_codec; - if (orig_priv_data) + if (orig_priv_data && src->codec && src->codec->priv_class && + dest->codec && dest->codec->priv_class) av_opt_copy(orig_priv_data, src->priv_data); - dest->codec = orig_codec; /* set values specific to opened codecs back to their default state */ dest->slice_offset = NULL; |