mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
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>
This commit is contained in:
parent
95f719fb8f
commit
53b2809f2c
1 changed files with 3 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue