From patchwork Thu Jul 9 10:35:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20907 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 1BDA844B499 for ; Thu, 9 Jul 2020 13:37:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0AA7A68B5B0; Thu, 9 Jul 2020 13:37:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F41C68B5B7 for ; Thu, 9 Jul 2020 13:37:09 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id f7so1825563wrw.1 for ; Thu, 09 Jul 2020 03:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5dlAuJmQiySIJF3k5oMbGPEszlTfkknan2NlKLxE1pY=; b=NLOvUlK1iBlj3NEw09Hr+F9HiSRxodbWbNheKy5atJswd1G6/4MsRsT5YeKZcunlrz fQwYGYvgcsgj2VcceRN7dA267R1g85pGUn6kLPTnCPyp7VILa6ZLaNCTS/RO9AYCLwf1 qPvMMLiOXYJNnZg28YZ6rcC/R5Auhye0c62ZMyMujZg3+rH5QkQ268lcMLFA0X+F12pV iZzBS+iKoOypIx7bjOqiDReS81Hc4oqWfqsd1VNR7HRqvxxgq7KjpFOlgBmg5zpjqP7s UR1HexB6yIYv/LsUA2hMWlPjEpCXI+W0UrPs665Ie1SRCd4p8ZD5FpXUAwHttdl+xY1z hU9Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5dlAuJmQiySIJF3k5oMbGPEszlTfkknan2NlKLxE1pY=; b=lMox1HKLDhAYo6jdnvOmV/i/7pFTFBcj3LUgyncvwl0pXaR5L6y7YdeWvCAcKfSjSE DHj+SrgxdjKZTmJQ65tyE+FmCX66DHVETNVe6BOM1wCLrptOVgtGz1q1sZokAJ28Lyct sf6Qp+48HI94EZ4iAwZOHxI+GgQdq0y9YZ5fa6vNaRyHoMNFNmKQX3mDu8c+nA75Tt39 BtdGMbl4PD75X9L6z9TH5D9CJzCc1xTI9EJKxM3bSA4Jcl4DZkdNBtEW/kfIUUkd7Xs6 x5Uf75PrbiBiJT+oN2TFptzu/5BSGzvN6tvY6vWa9FO8YMR6xDCrjG3hhWMYCvE4HS04 1eJg== X-Gm-Message-State: AOAM5330HSBWr2rE7ga9QPVB3bTPjNwyOve+b8JqmXocpHbkG5Dm2UGK D9MwqpgPRkQZHJcAi4C3eUSlmAD0 X-Google-Smtp-Source: ABdhPJw7jpBAynEfjqEow1Ke60rPQ/InCNgG7KneIv3jJvsEExLc+VaxXW/aVVl+sQFvJukjac3H9A== X-Received: by 2002:adf:84e2:: with SMTP id 89mr65342227wrg.139.1594291028431; Thu, 09 Jul 2020 03:37:08 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id c15sm4155623wme.23.2020.07.09.03.37.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 03:37:07 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 9 Jul 2020 12:35:38 +0200 Message-Id: <20200709103542.19909-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709103542.19909-1-andreas.rheinhardt@gmail.com> References: <20200709103542.19909-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] avformat/sdp: Fix potential write beyond end of buffer 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavformat/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 34e9839b67..2ce1a62262 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -212,7 +212,7 @@ static char *extradata2psets(AVFormatContext *s, AVCodecParameters *par) p += strlen(p); r = r1; } - if (sps && sps_end - sps >= 4) { + if (sps && sps_end - sps >= 4 && p - psets <= MAX_PSET_SIZE - strlen(profile_string) - 7) { memcpy(p, profile_string, strlen(profile_string)); p += strlen(p); ff_data_to_hex(p, sps + 1, 3, 0);