From patchwork Sun Oct 6 05:49:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 15532 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 DB28F446EF0 for ; Sun, 6 Oct 2019 08:50:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C39A2687FEB; Sun, 6 Oct 2019 08:50:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6EFD687FA3 for ; Sun, 6 Oct 2019 08:50:17 +0300 (EEST) Received: by mail-qk1-f195.google.com with SMTP id u184so9711958qkd.4 for ; Sat, 05 Oct 2019 22:50:17 -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=oYuF1NQ6U5i5nQ0uLg/qzUhIPcZH33xXLzSHQXUN5nA=; b=EekKCxvyGro3jllUy6nbVZsQkOPJM8njAKvIwhNYGDa8gmwV26rVp1nEi2R16eb6e/ niYGynM2S3c4hKY2Ua99mxD3x1psicgdiH+v/w3gf3B1xtn+XfckJIAa4bEurw4YBdcB r6UqDo7twmUaUeprJ1HVupOrWaScVZWVEizjxQauL8Vyqc6Cy656uewXDcwZvUK3nvgM JRlHfc4Bdzc+PvVfTVLSjimLScnDC4MOIY/kSarbOtXx0ZTnB5BA9A+Ed3wZo03x8R/X i7fBp7GA0I0oXAXuY4QMmtBQr/sakzTfXJRnCP3M5vgN0au0AOAZhgYhIDBUpxP91Xzp TOWw== 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=oYuF1NQ6U5i5nQ0uLg/qzUhIPcZH33xXLzSHQXUN5nA=; b=NDhctC8jaZaW7GVIxTR7EWznbES/OKRju+YrmdlNqNl5M1YEJbd7GJ3GXuZTDEPr2q 0wv1AIGYXsodTbNspkjYJUkg0DKLYjqWJ48nvwB8AvIfs7Q6KVYraz68yXS9xCjieqti YMpTUrlIieWt1wHy3PHPdUK0+lXfcbxH0c4o9tHHy2OD5LQWI1wR2l4HWsEdUB3NoEZg fW6WkuTr8kjwl9CfE/zKBgHZdODXVaRElde9rOZKEp5AA873dTm7GDkRt2XTxwnEH+Cc 0nj688ycVicdHYg30pgf58JKlF1uYr5FeB7aTWWd0hPG/weeGfgMcoATV4IdwqKCx8C/ y2QA== X-Gm-Message-State: APjAAAWrSuD/PVifbBegA3x8GybYiK9xdj66nvseiStmr578r81ZyXA5 Q3ahINI+vN0N73db7sXNDppuAYAE X-Google-Smtp-Source: APXvYqzTSZ4TW9a5KMTLfrPIII5pRr+j5mRHWfcEZhH92LELHpS8cVg75JN0oQqzZajO3synTwWOWw== X-Received: by 2002:a37:a411:: with SMTP id n17mr18359553qke.216.1570341016165; Sat, 05 Oct 2019 22:50:16 -0700 (PDT) Received: from localhost.localdomain (c-71-232-27-28.hsd1.ma.comcast.net. [71.232.27.28]) by smtp.gmail.com with ESMTPSA id 54sm8267073qts.75.2019.10.05.22.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2019 22:50:15 -0700 (PDT) From: Andriy Gelman X-Google-Original-From: Andriy Gelman To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 Oct 2019 01:49:50 -0400 Message-Id: <20191006054950.30374-5-andriy.gelman@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006054950.30374-1-andriy.gelman@gmail.com> References: <20191006054950.30374-1-andriy.gelman@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 5/5] avformat/chromaprint: Avoid null pointer dereference 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: Andriy Gelman Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Andriy Gelman As of commit 21b2442f in the chromaprint library, selecting "-algorithm 2" via the ffmpeg cli creates a null pointer dereference. This can be replicated by: ./ffmpeg -f lavfi -i sine=d=20,asetnsamples=n=1000 -f chromaprint -algorithm 2 - Until this issue is resolved, this commit makes ffmpeg output an error when "-algorithm 2" is selected for chromaprint versions > 1.2.0. --- libavformat/chromaprint.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c index faa92ca0db..3ecce3e08a 100644 --- a/libavformat/chromaprint.c +++ b/libavformat/chromaprint.c @@ -70,6 +70,13 @@ static int write_header(AVFormatContext *s) return AVERROR(ENOMEM); } +#if CPR_VERSION_INT > AV_VERSION_INT(1, 2, 0) + if (cpr->algorithm == CHROMAPRINT_ALGORITHM_TEST3) { + av_log(s, AV_LOG_ERROR, "Algorithm 2 cannot be used with chromaprint version > 1.2.0 because of a bug in the chromaprint library\n"); + goto fail; + } +#endif + if (cpr->silence_threshold != -1) { #if CPR_VERSION_INT >= AV_VERSION_INT(0, 7, 0) if (!chromaprint_set_option(cpr->ctx, "silence_threshold", cpr->silence_threshold)) {