From patchwork Sun Oct 6 05:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andriy Gelman X-Patchwork-Id: 15531 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 EDAB4446EF0 for ; Sun, 6 Oct 2019 08:50:24 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D9097687FDA; Sun, 6 Oct 2019 08:50:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 31CD6680249 for ; Sun, 6 Oct 2019 08:50:17 +0300 (EEST) Received: by mail-qt1-f193.google.com with SMTP id c4so1953735qtn.10 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=+2hMJlQ6uow0SJAJLCptosAAm+VWRa5G6I+M22XJ0aM=; b=o9PuLmdjO8aKGOGzx/G9g03SWoa2Me5VwbLIAMfselm8m+HAwCz5Ed4lXN9JCYdZwG K70LoO7UZfRVWy72SAeHO+Ydl+/TCUmpzAljnHGT/DHQ803y1pa3mWCN+mSENMlfnMYx fud/XMiFbwmRVhCk8DCbNKVjHz4dUY8PwhjFr9+8XG0vli0cndC9snek3wSWsmSkuf5d XsC6cWN7WR1octQRoEMppinLRkHfUCCEYrL8J6Pg+a8zClWfAQmapHnPrjXC0uMe85ah kPx4Wgghh6GWaHG2IdpPjwg5QsB/n6GvKPJhqfUd7g1p5+xK5PtfZbF8AMSnNZ+2os7O THIg== 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=+2hMJlQ6uow0SJAJLCptosAAm+VWRa5G6I+M22XJ0aM=; b=K7b3IpQFYi5fPysA2oqwjFQM6Kpu2qDz9c6+1WgyBTb0IN9FgdMz8UYRn3JjGVzCc5 S8UwxIjZARHiPVmjEQRzySUqzhzxgqMzoOjb61+Sit1JSUyWzE4xo8koefMaPUolVJve MASq++XGuHlTzisSVve2Annqy6fd5DXmM5il90ow/2uJGU62a7yujTtFMshQKbLGqfh9 pecQiVqqGagl+kG7tgNm6Fvz5MOjq7dBfLgyvKqa6N4mI2fBTRa0g7Kzsp5ufTfcQ38s KhIoz3OFWOJ273TEkK3LXGj0ofwC1kT3i2JA0JWFZoZyOfbiZkMzpDXvjkYlgYRMWTc/ Qe0A== X-Gm-Message-State: APjAAAXnuB0C6neLqtKXUsDzCazEyfV+jDhMxLDds1n0Lvhqn4l4b3kt ikTUvvdHUAFV0eIf1USJS4xXCI7v X-Google-Smtp-Source: APXvYqwNsxjriE+tPG7A0f38OUJ/MI3x+hj/anWXgm2Btn03HP7ieeDdS4gTzsaC12yWMNnGQOG5ig== X-Received: by 2002:ac8:3a86:: with SMTP id x6mr23863118qte.316.1570341015651; Sat, 05 Oct 2019 22:50:15 -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:49 -0400 Message-Id: <20191006054950.30374-4-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 4/5] avformat/chromaprint: Fix writing raw fingerprint 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 The pointer fp after the call to chromaprint_get_raw_fingerpoint() points to an array of uint32_t whereas the current code assumed just a char stream. Thus when writing the raw fingerprint, the output would be truncated by a factor of 4. This is fixed in the commit. For reference the declaration of the function from chromaprint.h is: int chromaprint_get_raw_fingerprint(ChromaprintContext *ctx, uint32_t **fingerprint, int *size); --- libavformat/chromaprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c index a4c0b97d99..faa92ca0db 100644 --- a/libavformat/chromaprint.c +++ b/libavformat/chromaprint.c @@ -136,7 +136,7 @@ static int write_trailer(AVFormatContext *s) switch (cpr->fp_format) { case FINGERPRINT_RAW: - avio_write(pb, fp, size); + avio_write(pb, fp, size * 4); //fp points to array of uint32_t break; case FINGERPRINT_COMPRESSED: case FINGERPRINT_BASE64: