From patchwork Tue Dec 26 05:22:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 6972 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp6451024jad; Mon, 25 Dec 2017 21:23:28 -0800 (PST) X-Google-Smtp-Source: ACJfBosMF5VqffDiMTItqbXc3AbIylp/4Zd/q8QPgqvPWcjL0g7kz9l9XcL/L9ompnjUfsL3za6v X-Received: by 10.223.165.28 with SMTP id i28mr18658379wrb.211.1514265808633; Mon, 25 Dec 2017 21:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514265808; cv=none; d=google.com; s=arc-20160816; b=j5LkIMIvNTAkrolUuZ9tdH1IBqOYA7/yBMbvALHdEKjJNEgmutBiHt7PSXLh5zDUyT H7Dyq1I/tz2N9wLeSfeuZNnx+kOtReeylurz1n0wwMI6ukDOtGC3mij+NeF7wdc3B/Uw 5PUBwJSZiiPc7YwcDIxmkC4Yy4fqW1QvjuJO/SWpjf4V3ZE83KWVMhFMQypN4L4VCj9M KUlN8sE0Vh6NaHkyc2XRYN2Ee7WpOgRR1IyF9knl95E2p4oTX4jO0R7tcECjkI1KDf71 u3Q8rVjLNvX9/2/masXuH/D6fHxKcEfudIT/KVBPPTJeq6+eWWybyGfEyCp5ChFx775P UeiQ== 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=hLn+bSxLS0fuMwBm34N2u1UQlFrB1MAJEc8kv2DGG8c=; b=UHmQ8oLFAHc38zw+LXFtfmzaPv19ggJHI8Zppx98tt2eMbtMnK/oHtH01ebMkqugH7 yjy1DN+XFX+HmkPl+eWw+S+21x6MFTiFlRuORCPchIjATLpwwO1VESEDcFSy3yZpySBP LwchCalAwFVGTEjnza7TOuwyBJI9lqbOIWaxXOnuwxPF7FfgBARPE/u/DGjdYjFEJM6R J0GpbHilWblTTJXHOOa+Y+2Em5PeG9wxf9FYQWwddXG5XVYI3F9OOgiUuS3mnJbiaBqm AjexjIzym7cbBo65OFNYWMiHZ4MNaQZ4jBF9WJ3DLEafSmJqRm+S5v87BmIeWs+zaoj9 FVew== 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=V9VhTr8n; 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 n24si12299215wra.405.2017.12.25.21.23.28; Mon, 25 Dec 2017 21:23:28 -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=V9VhTr8n; 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 51D0B68829C; Tue, 26 Dec 2017 07:23:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 36A60680C29 for ; Tue, 26 Dec 2017 07:22:59 +0200 (EET) Received: by mail-pf0-f195.google.com with SMTP id j124so18402449pfc.2 for ; Mon, 25 Dec 2017 21:23:12 -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=uUZ5sr1RlRxSTxsiGXDbv+EOw+NNdpkqpCM7Q0tBEbM=; b=V9VhTr8nHjIgM8sHfC9al6WzEV9Zowa/xOLS1IP5kkPBT0N6BTqmE3Hv6TJnuzxmMj X4QWsmBSbwtBateg8E5zBZb9royqrduMhBuhx2M8wyu8RJkNMRGuITT5nBLA8xMhs/oC mvpXURr5TtkIjAUp0iFjPdIZSPHkkHIPEDINC8WaTiA5thPQ6eZkX6NCplAf4NhFWkHV KGlueZlh7GnF6BVwQ/Jhd45kzfvn/3kTGh6kPy+stEnx1lJM2P/w4/PWIg3hhAEJ3xN3 g/cpiDLJDRV+pxOpMGmfotWYlhixK9tkSI77z8rVbMGOzRX5iOhueHYdSdMvW1rkVd0/ 3BvA== 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=uUZ5sr1RlRxSTxsiGXDbv+EOw+NNdpkqpCM7Q0tBEbM=; b=CwanGNsO7jOVQzPm2TrFo9KHD+xsOOHgSq2GlU0oRWGH1YmY6mQNP6capYcgiVWlgK E4xzd29JGv8hkUbWfU5NbtrVVEnGJ6Pb6NTnnl2VoyTsar3kyAPpadVqh7Khe5agthDn 8skprJTp7GEvb43SxF2OV9i3RV+pYkiG2Ak61klUr+5ptX0jso12VGWfnqrgS2DU8/dA 3dAsQVrEc36bXu+bDoo3C0AoH9q+nwOk22gIWXwl/PMnU8O2w0WU8RXQ8FYsz+TQVI4C vqoxYN4XMnT87TReSFoCo2xMUFRetbsoQJylp7YVmDZpcIULTBkGWAipGPOz1raNV31G BIRQ== X-Gm-Message-State: AKGB3mLnpVksMV9S8yXiiT0TXBDd4t8gCduvWNb+gE+KB6YTUstKLLva X4UE5T724kb5k+YY+aZZ7xB1v+8+ X-Received: by 10.99.146.23 with SMTP id o23mr21615405pgd.380.1514265790728; Mon, 25 Dec 2017 21:23:10 -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 s5sm15540784pgp.91.2017.12.25.21.23.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Dec 2017 21:23:10 -0800 (PST) From: Aman Gupta To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Dec 2017 21:22:59 -0800 Message-Id: <20171226052301.17509-2-ffmpeg@tmm1.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171226052301.17509-1-ffmpeg@tmm1.net> References: <20171226052301.17509-1-ffmpeg@tmm1.net> Subject: [FFmpeg-devel] [PATCH v2 2/4] avformat/hls: respect http_persistent only for http playlist urls 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: Aman Gupta MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Aman Gupta Fixes a segfault when reading a live playlist (without end tag) from non-http url (like a file on disk). Signed-off-by: Aman Gupta --- libavformat/hls.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 73bf55b791..c30d71a477 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -724,8 +724,9 @@ static int parse_playlist(HLSContext *c, const char *url, struct variant_info variant_info; char tmp_str[MAX_URL_SIZE]; struct segment *cur_init_section = NULL; + int is_http = av_strstart(url, "http", NULL); - if (!in && c->http_persistent && c->playlist_pb) { + if (!in && is_http && c->http_persistent && c->playlist_pb) { in = c->playlist_pb; ret = open_url_keepalive(c->ctx, &c->playlist_pb, url); if (ret == AVERROR_EXIT) { @@ -759,7 +760,7 @@ static int parse_playlist(HLSContext *c, const char *url, if (ret < 0) return ret; - if (c->http_persistent) + if (c->http_persistent && is_http) c->playlist_pb = in; else close_in = 1;