From patchwork Fri Dec 29 23:41:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 7026 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp11058667jad; Fri, 29 Dec 2017 15:47:22 -0800 (PST) X-Google-Smtp-Source: ACJfBovx0LxeuhH20ZxVof26gm8gRwYSyYNDYVmMpTPqNyvgrqAxH3ADpCguoDooXDMsRntzlTXk X-Received: by 10.28.198.139 with SMTP id w133mr32447261wmf.13.1514591242414; Fri, 29 Dec 2017 15:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514591242; cv=none; d=google.com; s=arc-20160816; b=VLjCVUybbKc08C06mywiY1IySAcz6ICRi9XnwydHVqm/JE4YNzcdXVjb4D5sqTfQBz IVx3EB3FBhSR3d8/4367/6t0mKAxFCE1BL+tx2kkNzMuLn/OqqvZvqI6/palUAggz7VL +jMPaz9Gp+hUiv4bNqFYFij5eiDvAE01y3fNM8GYTCFjpXAfZqlYB/M2NbG1Ozor1a99 Q9wjW6SH9jBjHh8MTuTF+c26/oEuMVCraz8hLzgzJL8a1TWa9DvU3/kydNABCGHooYPq PXUpZ1VbzOGKBrr7SAbCxx9xebkDsgV3ubdxAKanrImj5cTyuaxT0lhnd5dB+pRZWPa3 hT0A== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Cwm84zktGqJhphlV8MCqRUXEQVwVFXfWqE+QXCMGwnU=; b=zDmUjn/ci1/kcjwyD1om5QrJ//fNw+IHT+JlywDAur77N44gZzYe/8CQPu/7C+laLG ZtQwUvA3FFsoOlg2MwnqE70NLiq1g06E8nKcmYe0WPgAcXgn8t+q1zDIW2uoFQIs2Sls x4ttHmxUHOH1xoGOoZNyw+js3febXqn/sHgY9OKFssMpeKcfLnGTVfLiHUcp+74QqWg0 E85hYNCVaMH2AX4Mpqr1R8LyByFWEfemrtTnk0fR4dsfrWiKX+TYb/zAs1BgFS807j2m r9GiO2kqmoqegA9xL1N1IDJYWLGndco2dvI+KGq0TZqaGNF5hdjNxnNTmB4X7yah4QPa TqMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=EMMlW8P1; 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 p63si16433703wme.115.2017.12.29.15.47.22; Fri, 29 Dec 2017 15:47:22 -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=@tmm1-net.20150623.gappssmtp.com header.s=20150623 header.b=EMMlW8P1; 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 B0B0A689A5B; Sat, 30 Dec 2017 01:47:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86591689A05 for ; Sat, 30 Dec 2017 01:47:00 +0200 (EET) Received: by mail-pg0-f68.google.com with SMTP id q12so4454671pgt.7 for ; Fri, 29 Dec 2017 15:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tmm1-net.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=yIfC/eR+kHX/T9+s0Qwg+YlSOfmNpsQzT6JuDNx26gk=; b=EMMlW8P1qn8OBTciaEhk/W7QY4XHYSiuKYLIqYrGoFouqDXGhwqoBArTsOF5scq2Tt yBVWQFiWmXSUN1JRwef+XTOMPqDE9QGcAOuDfznL4ych+gyY3b1SfbnkkWL0pcelWF8R aeQrtcLpOj2IRGL6RHTIXGVP3cqUA6dtquscyzd9GshvbmzJsPWBCYs4CVEckeFvu3b8 sbH1C7FY28xFe6Pw7KhUCl6mcSeFIU0O7V62KWvVCtfJQnJaedP5gcOHWI8JATGZIh7+ iXnmSwfHIirMRvSYuizTo4g07kaS1jxxzXOdJj2LjPvmRpo41lWe1J9o+4fFymGp4VKN /hPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=yIfC/eR+kHX/T9+s0Qwg+YlSOfmNpsQzT6JuDNx26gk=; b=X+HaTEwufEFTiqQgmUXYnVk5pvy1Yam4CyNt29XY9Hzr70AZvEk+I2g4VMd1OEz51P fQkg1jyKka/XoLISoFJKe72Xj4ZUs8Nx4TF6Xw5tShyQFoaG7pfnyrkM9l8eLvEiofps O/X0Plh8qX7eDxFNUvIluvIV6gPY8ld7QvaRenFPacg65yU290t+Nf1sFH32OAv8WfbF gIQj5WcXEh1A2wzgFHWysM4ui52cXbdlDhtGZEIzmQ0sadJ9fv0GU0HL1Zbrjw5vQV06 h8hMLV7Erri7Usi01oFsfamrXwcCOs3lH6Uuk15v2bjLkLqqNHwsDAd8Irz4FgndZA4X ARug== X-Gm-Message-State: AKGB3mIzzM+HvHzNBdQaPCCWv/dtP+KzzwZsmIXr0YEdXeQ/DFgFJxna A86s2skBPQA/sCjyBc9eAFFAgau+ X-Received: by 10.99.153.2 with SMTP id d2mr31381278pge.379.1514590924872; Fri, 29 Dec 2017 15:42:04 -0800 (PST) Received: from localhost.localdomain (c-69-181-54-242.hsd1.ca.comcast.net. [69.181.54.242]) by smtp.gmail.com with ESMTPSA id m23sm6565161pgv.45.2017.12.29.15.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Dec 2017 15:42:04 -0800 (PST) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Fri, 29 Dec 2017 15:41:57 -0800 Message-Id: <20171229234158.33456-1-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH 1/2] avformat/http: return EINVAL if ff_http_do_new_request is called with non-http URLContext X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: anssi.hannula@iki.fi, Aman Gupta , george@nsup.org, kjeyapal@akamai.com, lq@chinaffmpeg.org MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Signed-off-by: Aman Gupta --- libavformat/http.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index a376f1a488..8f7e56de54 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -311,6 +311,11 @@ int ff_http_do_new_request(URLContext *h, const char *uri) char hostname1[1024], hostname2[1024], proto1[10], proto2[10]; int port1, port2; + if (!h->prot || + !(!strcmp(h->prot->name, "http") || + !strcmp(h->prot->name, "https"))) + return AVERROR(EINVAL); + av_url_split(proto1, sizeof(proto1), NULL, 0, hostname1, sizeof(hostname1), &port1, NULL, 0, s->location);