aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-01-10 17:41:02 +0100
committerAnton Khirnov <anton@khirnov.net>2022-01-11 09:17:23 +0100
commit91aa03952a7ad36f08367ba145dbf0d5f7d23356 (patch)
treefdf0464a465a301cf490d8f159aa1005db08e902
parent458c00ea0b15cb2a105bd33967e432baa1db740a (diff)
downloadffmpeg-91aa03952a7ad36f08367ba145dbf0d5f7d23356.tar.gz
lavf/udp: do not return an uninitialized value from udp_open()
(cherry picked from commit 3c2b67446875f925909fa33d8ee14264e11c293d) Signed-off-by: Anton Khirnov <anton@khirnov.net> Conflicts: libavformat/udp.c
-rw-r--r--libavformat/udp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 9b9d3de197..1f8b85cfca 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -740,8 +740,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;
@@ -754,8 +756,10 @@ static int udp_open(URLContext *h, const char *uri, int flags)
udp_fd = udp_socket_create(h, &my_addr, &len, localaddr);
else
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