[FFmpeg-devel] [PATCH 2/3] udp: Check the port number provided by av_url_split as per docs

Michael Niedermayer michael at niedermayer.cc
Fri Nov 24 01:28:56 EET 2017


On Wed, Nov 22, 2017 at 03:28:41PM +0000, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derekb at vimeo.com>
> ---
>  libavformat/udp.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 0dde035..7bbd282 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -443,6 +443,10 @@ int ff_udp_set_remote_url(URLContext *h, const char *uri)
>      const char *p;
>  
>      av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
> +    if (port < 0) {
> +        av_log(s, AV_LOG_ERROR, "No valid port number found in URL.\n");
> +        return AVERROR(EINVAL);
> +    }
>  
>      /* set the destination address */
>      s->dest_addr_len = udp_set_url(h, &s->dest_addr, hostname, port);
> @@ -798,6 +802,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
>  
>      /* fill the dest addr */
>      av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
> +    if (port < 0) {
> +        av_log(h, AV_LOG_ERROR, "Missing or invalid port provided in URL.\n");
> +        return AVERROR(EINVAL);
> +    }
>  
>      /* XXX: fix av_url_split */
>      if (hostname[0] == '\0' || hostname[0] == '?') {
> -- 

this seems to break rtp / rtsp

ive traced it to
ff_rtsp_make_setup_request() calling ffurl_open_whitelist() without
a port

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

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171124/c9b3ecfb/attachment.sig>


More information about the ffmpeg-devel mailing list