Message ID | 20220110165143.2292-1-anton@khirnov.net |
---|---|
State | Accepted |
Commit | 3c2b67446875f925909fa33d8ee14264e11c293d |
Headers | show |
Series | [FFmpeg-devel,1/4] lavf/udp: do not return an uninitialized value from udp_open() | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
On 1/10/2022 1:51 PM, Anton Khirnov wrote: > --- > libavformat/udp.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/libavformat/udp.c b/libavformat/udp.c > index b8b0e19609..180d96a988 100644 > --- a/libavformat/udp.c > +++ b/libavformat/udp.c > @@ -739,8 +739,10 @@ static int udp_open(URLContext *h, const char *uri, int flags) > /* XXX: fix av_url_split */ > if (hostname[0] == '\0' || hostname[0] == '?') { > /* only accepts null hostname if input */ > - if (!(flags & AVIO_FLAG_READ)) > + if (!(flags & AVIO_FLAG_READ)) { > + ret = AVERROR(EINVAL); > goto fail; > + } > } else { > if ((ret = ff_udp_set_remote_url(h, uri)) < 0) > goto fail; > @@ -750,8 +752,10 @@ static int udp_open(URLContext *h, const char *uri, int flags) > s->local_port = port; > > udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr); > - if (udp_fd < 0) > + if (udp_fd < 0) { > + ret = AVERROR(EIO); > goto fail; > + } > > s->local_addr_storage=my_addr; //store for future multicast join LGTM.
diff --git a/libavformat/udp.c b/libavformat/udp.c index b8b0e19609..180d96a988 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -739,8 +739,10 @@ static int udp_open(URLContext *h, const char *uri, int flags) /* XXX: fix av_url_split */ if (hostname[0] == '\0' || hostname[0] == '?') { /* only accepts null hostname if input */ - if (!(flags & AVIO_FLAG_READ)) + if (!(flags & AVIO_FLAG_READ)) { + ret = AVERROR(EINVAL); goto fail; + } } else { if ((ret = ff_udp_set_remote_url(h, uri)) < 0) goto fail; @@ -750,8 +752,10 @@ static int udp_open(URLContext *h, const char *uri, int flags) s->local_port = port; udp_fd = udp_socket_create(h, &my_addr, &len, s->localaddr); - if (udp_fd < 0) + if (udp_fd < 0) { + ret = AVERROR(EIO); goto fail; + } s->local_addr_storage=my_addr; //store for future multicast join