[FFmpeg-devel] [PATCH] lavc/options: don't copy priv context when it is not AVOption object

Michael Niedermayer michaelni at gmx.at
Wed Dec 3 01:15:37 CET 2014


On Wed, Dec 03, 2014 at 12:06:47AM +0100, Lukasz Marek wrote:
> This prevents potential crash when opt API is used without a class.
> 
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  libavcodec/options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 7f9fb07..42ef754 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -196,7 +196,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
>  
>      dest->priv_data       = orig_priv_data;
>  
> -    if (orig_priv_data)
> +    if (orig_priv_data && src->codec && src->codec->priv_class)
>          av_opt_copy(orig_priv_data, src->priv_data);
>  

"&& src->codec->priv_class" <--- LGTM
the src->codec check is probably ok too but is it NULL ever ?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/937f8286/attachment.asc>


More information about the ffmpeg-devel mailing list