Message ID | 1511364522-40586-3-git-send-email-derekb@vimeo.com |
---|---|
State | New |
Headers | show |
On Wed, Nov 22, 2017 at 03:28:41PM +0000, Derek Buitenhuis wrote: > Signed-off-by: Derek Buitenhuis <derekb@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 [...]
On 11/23/2017 11:28 PM, Michael Niedermayer wrote: > this seems to break rtp / rtsp > > ive traced it to > ff_rtsp_make_setup_request() calling ffurl_open_whitelist() without > a port Looking at: https://github.com/FFmpeg/FFmpeg/blob/1e27837265702b63db65122e97178a0ca4d25e05/libavformat/rtsp.c#L1466-L1476 It seems it's using '?localport=<port>' instead of specifying a port... Is there a particular reason for this? It seems... odd. I don't know the RTSP code, really. - Derek
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] == '?') {
Signed-off-by: Derek Buitenhuis <derekb@vimeo.com> --- libavformat/udp.c | 8 ++++++++ 1 file changed, 8 insertions(+)