From patchwork Mon Jan 10 16:51:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33182 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp2897565iog; Mon, 10 Jan 2022 08:52:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6NJhR/HshU9xUxD289h2u43lF0GHqrz2syFRycS1ThEZxkqqtBTV2pAj51avSTuOVmEHK X-Received: by 2002:a05:6402:350f:: with SMTP id b15mr523686edd.274.1641833565853; Mon, 10 Jan 2022 08:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641833565; cv=none; d=google.com; s=arc-20160816; b=AjJfs7xocujUWxBzXA+nSayivIToj7cLknD1e+SyWjMNL8I+uVukLH47bKwkelKuYK m5RgKMyfA5Bi/iAwkyZFpFfLPA75yg3AaurqiDudx+clOla3/z9ONBkXkmgB0IBkcdqm xEkrqNUH5R2E/mlUOJlLBv8hX6qk7nTkTMMZx8D0HeQw1J0i2VpySAVWE4jBOw5vvdtc oW11cOFoj/AESB5prAd6orIyc5XE0qX5MBq/V1pIvHVxT/NSU6nETuAL/7XdpzxTQ3Rs WmoFtYQLELTuSYO7sBe/7J5bWXXBJ8mS5p2zpAc2Ev8expQ8NZjP52e7x+TkBfuRgGlD +jnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=vLyWBus2WRfZvvlCqRB0TXj01Prcmeyg6Rv8Tnht1v0=; b=UDlufXL0mwoJ2HdiH2YWIHb/YTV8fXbnGy6pF3TyJBEEAcYX2TKFZJ8fYZxvk4Hh8e Gsw71XS3eGnDD007AnftTiTrcY2U1dYA2TA9XgOoNLyO6obp6RI2xyjCCZ2JaWxRvQtf pNDssgOPKhJdVWsWeig/n3+JwoZnBzPgilBu1EqjsAmT4lpEM5zipiKzOB4EuOLyMlBO KObulE2FD+6vBoo5OAaKvsa/PTP++oIu7d0hubSGqoFyPRXHB3TEHshegDl1iEyOvBQn IetduoiLmt9o0qLO3LTUonWgtCUD+8S6vsT89sQp1DVFPXscEzBjJOBG3VTKwKkL5f08 u8qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h14si4319420ede.261.2022.01.10.08.52.43; Mon, 10 Jan 2022 08:52:45 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 97BCE68A320; Mon, 10 Jan 2022 18:52:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DA176803C7 for ; Mon, 10 Jan 2022 18:52:33 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 890D2240506 for ; Mon, 10 Jan 2022 17:52:32 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Hihf7_5puc_i for ; Mon, 10 Jan 2022 17:52:31 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 7461E24017C for ; Mon, 10 Jan 2022 17:52:31 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 4E5B23A0631; Mon, 10 Jan 2022 17:52:31 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 10 Jan 2022 17:51:41 +0100 Message-Id: <20220110165143.2292-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] lavf/udp: do not return an uninitialized value from udp_open() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6r814+Ju3yD6 --- 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