From patchwork Tue Oct 13 05:59:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Miceli X-Patchwork-Id: 22904 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 497AD44AAE7 for ; Tue, 13 Oct 2020 08:59:48 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2A08C68BAE6; Tue, 13 Oct 2020 08:59:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C2DFC68B825 for ; Tue, 13 Oct 2020 08:59:41 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id n14so16051984pff.6 for ; Mon, 12 Oct 2020 22:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miceli-net-au.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pmJBO+jjX8DVinJVnqrL5y4e4cw9CH/a+rk++biObPY=; b=YPnBKlwDZk8c2pbvcLJagm8QBg5K1VjapwUwwUONHBgTBW401QXut+a/MIT3jOAzdJ nBFKN5/7YUrlALoIyLL62u5eOXY3HK0f5SlTNCQ+6IX3NUp7l6YLmeMMeLNKj/4pL7Ae MFJXKh+4GSb0xqgGdSojRTxf3VPyRJENm3R4cFw1C0nYHRdW3T6/Ep4ocHtCqp9eJbgG zEm3eeMZCCXYOEJzZyQKCLCswRJqxhDwFov6YSUKlSP180+fUCYtXTeqek8y3JMlgVRa 2sIJAAYpTg8btPvUp+PCYl3017SBqxDFiYQq4XhvE4ghGgukHfErIsOMkCJ/2B3DQuOc ApvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pmJBO+jjX8DVinJVnqrL5y4e4cw9CH/a+rk++biObPY=; b=ELUZTAfZ1mwlCbwKQCf4t0emjIWtt4XcwrUAHFAtYI7758xxA/+r+aV8267LK7FXK3 QcOSXkfDOC33A03eZcr8xYB9SARWvI9mzSh8aTxjqrVuVphu7Lu+DKPOaVD6bAsNJMGb Vf6a6nYiRsWBAuPFzIctcBH06Y4kN3dGQw5Gu4NufAzm0QXJAkVIaeiMPqYtBEfvt1Fs fm5ye8rs7/Qx9D8N8ecEJCR+w9NB291aGPQlwnn+v/9bL9J2vL8lod44oR/zdPWkFw7M tOeCp+TxX1whGNdr4CdMOsxi4d0rjhRTG2pWsszUtMBCqbwRbXSrJcTrv3kTN18ewrkm a7+g== X-Gm-Message-State: AOAM532+iTuTOpyt4hz4+xi+fdogRuigeVDxR8pOdNCM0pF4Bs6tTFGu DXtJoJ98+Z6wOkDuq43XeUelci8VcWR01Dlb X-Google-Smtp-Source: ABdhPJzUBsZUNUCTKNXGNh9Q/K7cY8WZTMAsYbO/JkB15Az3vUJye4Xqngt53djhHubRM0KmxFo6Bw== X-Received: by 2002:a62:dd02:0:b029:142:2501:398c with SMTP id w2-20020a62dd020000b02901422501398cmr26002606pff.81.1602568779578; Mon, 12 Oct 2020 22:59:39 -0700 (PDT) Received: from edna.localdomain (119-18-3-107.771203.syd.nbn.aussiebb.net. [119.18.3.107]) by smtp.gmail.com with ESMTPSA id u8sm21199540pfk.79.2020.10.12.22.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 22:59:38 -0700 (PDT) From: Chris Miceli To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Oct 2020 16:59:29 +1100 Message-Id: <20201013055929.239723-1-chris@miceli.net.au> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavformat/hls: check new_init_section for null 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: Chris Miceli Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" new_init_section will return NULL under circumstances where the init failed and this code needed to check for that. ret and goto fail are how this is handled throughout the code. --- libavformat/hls.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 72e28ab94f..6c5c2f2061 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -828,6 +828,10 @@ static int parse_playlist(HLSContext *c, const char *url, ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_init_section_args, &info); cur_init_section = new_init_section(pls, &info, url); + if (!cur_init_section) { + ret = AVERROR(ENOMEM); + goto fail; + } cur_init_section->key_type = key_type; if (has_iv) { memcpy(cur_init_section->iv, iv, sizeof(iv));