From patchwork Mon Feb 7 10:37:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 34157 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp5673073iov; Mon, 7 Feb 2022 02:38:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLU8UdpbtTGti0Nx0qKJOXw0+6xVIyZqm4TvAgl7OJMoEeKYKpX2OOpqzHgE/xp6apf7R5 X-Received: by 2002:a17:906:6a93:: with SMTP id p19mr9524908ejr.711.1644230300344; Mon, 07 Feb 2022 02:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644230300; cv=none; d=google.com; s=arc-20160816; b=XQ6/h4Ibwo4rACq1hJe3nk2RAUBuXPuHtQ4dS5OmejmLzuZAMPYSIArEoUeeNDRccY 3Xfr7FipPtDYXeDXXQr8tmslWJFkbFNmwqRlpgGxWbrIXzto0Fa+uH4vJOnoNC/IqlYc CTqcLpgicVh1nWuRr+z2jfZh1PAfJLmIGY50c5JV+RhivDynVm1J4KOX2EdIGEwlOl32 ZD+gmrU/kobrUrprdjhT7osqJz4TRrtQ5MWPC6uIRo/IfDogeHT0r8sq7vCsDF/+aDj4 N7eCJNGRFS3ghsI3rdJjx2YsO4AkH+jL3RW64PlM41DYgmt4kKRsQ9aTlcDXviRnEh/l 1pFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=Xcy7ocNgNUoRg9iYuI585ffgLhLWGXTNCsR+0ykrLTM=; b=UiIZRRqcuxgbBq49DjlFY/mQwLcnY7Z9aFpJwQjvBQvG4yFzuQDWUF38YSLmHjLWyL yeahM4A8A7h4ARq18i3uiM3kFCoRbi8sEVI7mgnjmduk1H0acHSCPa6IpZfDI4ZnxoKl htiR6XLgDhePqnjrkkyowymbgmEY5POE0IXxtfefkx2iNhjWUvqmLitEqacYbmo5BGP2 yEGeykG9ahW9BIRDqVOCQo0AUOk9kU0prDbh92QI8fwDjnILIcRzuNbvKqsoCx0HV3Nh XumoiyR5B2RjwZFzJ2A+LTVdVbDqXc//swt+V2xWgG/Kxv889Q5nDVG6li7CLnN1Pg77 /+6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=GptSmOk6; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qb40si3666926ejc.127.2022.02.07.02.37.57; Mon, 07 Feb 2022 02:38:20 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=GptSmOk6; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 54CBA68AFCD; Mon, 7 Feb 2022 12:37:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B762F68B269 for ; Mon, 7 Feb 2022 12:37:46 +0200 (EET) Received: by mail-pl1-f175.google.com with SMTP id k17so10834496plk.0 for ; Mon, 07 Feb 2022 02:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=XtWmvWoH6e5XY7/pGgnDiSmf4GSuiozZP9BqBldKyM8=; b=GptSmOk6XlPcbn6lBWNs1sT8PnET9VRoRA5TPDMdcb4X6t4/+FPXPknPm/j0gb5DLa VJBtxHBEzLCN0PJ6UjDBMiZ1/Kk2UGL8LjIiCheW9QXeAu0LeTmeBEPTWdBOthawcXy9 s9qkh3dWfzgom4VWBjXZUZoHdhDu6/FJkBPBjALHeL3ETKgjO5WNC+XC0UDAivbRBiuF y9uBVeEI4VpB9Odh7dIgwgHlsP4g5z/O60Z09n6Thlzgi6eIIlzjcci4ok3ry+Lnj8qw soqenqV2tHlicQySDsMYGMhhF3gzn3iNvm+nPjtmy8PbuYyYgZjfHoSWp1yYb0zD7oBW 900g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XtWmvWoH6e5XY7/pGgnDiSmf4GSuiozZP9BqBldKyM8=; b=qHUVVEmzcoFmaf0TIau/0lp0l4w76zo/bzrn60z4cAsxYJvtL3zIIleekrVFatuhUo x2/Dp9cGx2V30yT+HCuGDS11IYDYxQHokE+ADEcdYak6qt55ZawWXMbW4sNrFzq6e+Az gnRI7jkLC+yfX9UmtmPqo8WWkEPdHa0eT2CWpPrUqIoPKGyvwKtUq2S1qDUBOdivEax6 ww4aH24TMb4w+VIoPgXMOc8mq2MXrJhTL/EIDSEBXjWM3aHnrAs9Kqyu1Ehp+uTi6LDb pjFN9x5xaOW5RzRsWuQSHx1emnzt8LK1C6TEL9VhRu9uTYi7gLi2FcdjewJ+WJgtvIQp gL+Q== X-Gm-Message-State: AOAM531H5riCSRcSH1/v7VC/8uiAM86/naubmups+fUa5mt7SDGHk4la DvTlxqs5xWYjDRV7ipCpbkm8AXT+Phk= X-Received: by 2002:a17:90a:c283:: with SMTP id f3mr14741866pjt.138.1644230264792; Mon, 07 Feb 2022 02:37:44 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id n3sm10794462pfu.84.2022.02.07.02.37.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Feb 2022 02:37:44 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Feb 2022 18:37:40 +0800 Message-Id: <1644230260-31752-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH] avformat/udp: properly check for valid ttl in url 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VcPduXvTRcCM From: Limin Wang Zhao Zhili added a ttl upper bound in commit 9daac85da8, but the check for ttl in url is missing still. Signed-off-by: Limin Wang --- libavformat/udp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/udp.c b/libavformat/udp.c index da56c8e..401d9b6 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -674,6 +674,11 @@ static int udp_open(URLContext *h, const char *uri, int flags) } if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) { s->ttl = strtol(buf, NULL, 10); + if (s->ttl < 0 || s->ttl > 255) { + av_log(h, AV_LOG_ERROR, "ttl(%d) should be in range [0,255]\n", s->ttl); + ret = AVERROR(EINVAL); + goto fail; + } } if (av_find_info_tag(buf, sizeof(buf), "udplite_coverage", p)) { s->udplite_coverage = strtol(buf, NULL, 10);