[FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL
Steven Liu
lingjiujianke at gmail.com
Wed Dec 27 08:18:59 EET 2017
2017-11-20 15:58 GMT+08:00 Steven Liu <lq at chinaffmpeg.org>:
> fix ticket id: #6846
>
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
> libavformat/avio.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 4dc468350c..63e82872f7 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -625,13 +625,15 @@ int64_t ffurl_size(URLContext *h)
>
> int ffurl_get_file_handle(URLContext *h)
> {
> - if (!h->prot->url_get_file_handle)
> + if (!h || !h->prot || !h->prot->url_get_file_handle)
> return -1;
> return h->prot->url_get_file_handle(h);
> }
>
> int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
> {
> + if (!h || !h->prot)
> + return AVERROR(ENOSYS);
> if (!h->prot->url_get_multi_file_handle) {
> if (!h->prot->url_get_file_handle)
> return AVERROR(ENOSYS);
> @@ -647,15 +649,15 @@ int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
>
> int ffurl_get_short_seek(URLContext *h)
> {
> - if (!h->prot->url_get_short_seek)
> + if (!h || !h->prot || !h->prot->url_get_short_seek)
> return AVERROR(ENOSYS);
> return h->prot->url_get_short_seek(h);
> }
>
> int ffurl_shutdown(URLContext *h, int flags)
> {
> - if (!h->prot->url_shutdown)
> - return AVERROR(EINVAL);
> + if (!h || !h->prot || !h->prot->url_shutdown)
> + return AVERROR(ENOSYS);
> return h->prot->url_shutdown(h, flags);
> }
>
> --
> 2.13.6 (Apple Git-96)
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
ping
More information about the ffmpeg-devel
mailing list