[FFmpeg-devel] [PATCH] libavformat/avio: NULL check for URLContext in ffurl_write().

wm4 nfxjfg at googlemail.com
Wed Feb 7 13:22:13 EET 2018


On Wed,  7 Feb 2018 08:57:26 +0530
rpatagar at akamai.com wrote:

> From: Ravindra <rpatagar at akamai.com>
> 
> Signed-off-by: Ravindra <rpatagar at akamai.com>
> ---
>  libavformat/avio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 63e8287..18e58ae 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -420,7 +420,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
>  
>  int ffurl_write(URLContext *h, const unsigned char *buf, int size)
>  {
> -    if (!(h->flags & AVIO_FLAG_WRITE))
> +    if (!h || !(h->flags & AVIO_FLAG_WRITE))
>          return AVERROR(EIO);
>      /* avoid sending too big packets */
>      if (h->max_packet_size && size > h->max_packet_size)

Why would this ever be NULL? It looks like a caller error to me, not
something the function should handle.


More information about the ffmpeg-devel mailing list