From patchwork Sun Apr 25 07:03:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 27343 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp2940814iob; Sun, 25 Apr 2021 00:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi4xmWyB+MVeUEFIW6L35MOmo156gQ5fRk7PvmctBidmIJPHigB5tH0+j+HYu7UG3fepKw X-Received: by 2002:a17:906:bc8e:: with SMTP id lv14mr1591096ejb.418.1619334251726; Sun, 25 Apr 2021 00:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619334251; cv=none; d=google.com; s=arc-20160816; b=v5snjSbDcKYosuHUeja0Njf1VmdCT+mZrRaCY55gy/A/5DNRR0GdQHsevU60cRDOZ1 DGfLQIQHsiVR91zOZCNJ6fRi4SE6DhMbwJFi5rhOgiqnjhJtAhJerlvdzktphbeh2QYT s3paV9yDx4T/RYzlD9DI/1k/U4iLNFxN4NDp6/vyw0KKOoxmvnI7fBrzALjD5HxPNm1i ksLiavBAv3n9bx7mzl1zHixpVo/LbugAK9VJpgJow9uxtyUoKWDWp4p7Rl/GGpHJ0QT3 p7T/QtPLk7Bu7L4v72xFfpxMezfk7Yu7un/pyn0zJlcTRsUT0ZwOQYwYcSQY3dlKihIU PJbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=HvaYHhwRXgMGddYJSXRYG4WElzapjwN8u8fqV7FGMpI=; b=pOQKjKvXlpTZ1NzQzczVUfwPiA7YgZX5kq/LVkZniFCVXkTCfOb6gBj8tZ7Cj6xnqM 7Lfe19hv8mR6Ix/pSUdBlueif0D3bZI5pqpjoMjkPlC0XxQzmgVQ2nluyc/HgVRFAkgX bYv2xcjPEpbsHG5cG4WB1HlTnzjW4O/G6g82ir0YpnrCIy0gfhlL2IiyVHXqmCuCPzwA 9GwOtNNfJXA1LwO4Vov1k8RVRE7TzlsX71lnqu0RArkLe6rYO0aC+Eb0t4VeSeCoICWO lqkBQhDMwxIotzzjzqPA9Syz8NSZoB/+JGQJ7OE4/T69/S+hERYDq/iIxgiL+g/LHVqO pnKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 kw6si9978092ejc.380.2021.04.25.00.04.11; Sun, 25 Apr 2021 00:04:11 -0700 (PDT) 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; 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 D43C9687F5A; Sun, 25 Apr 2021 10:03:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E56FA680CEC for ; Sun, 25 Apr 2021 10:03:34 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 7B5EE240476 for ; Sun, 25 Apr 2021 09:03:34 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id xZH-GDcop9Ng for ; Sun, 25 Apr 2021 09:03:34 +0200 (CEST) Received: from libav.khirnov.net (unknown [IPv6:2a00:c500:561:201:a640:2e1a:caa3:698c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 0D67B240477 for ; Sun, 25 Apr 2021 09:03:32 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id CBBF83A0922; Sun, 25 Apr 2021 09:03:28 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 25 Apr 2021 09:03:09 +0200 Message-Id: <20210425070320.14197-1-anton@khirnov.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/12] ffprobe: only hash extradata when it is present X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GdLWc14I3BD6 Passing zero-sized/NULL buffers to av_hash_update() is invalid and may crash with certain hashes. --- fftools/ffprobe.c | 7 +++++-- tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov | 1 - tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a2cb7dc986..9039985dcb 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2741,8 +2741,11 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id if (do_show_data) writer_print_data(w, "extradata", par->extradata, par->extradata_size); - writer_print_data_hash(w, "extradata_hash", par->extradata, - par->extradata_size); + + if (par->extradata_size > 0) { + writer_print_data_hash(w, "extradata_hash", par->extradata, + par->extradata_size); + } /* Print disposition information */ #define PRINT_DISPOSITION(flagname, name) do { \ diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov index b69181ace7..4ef569df89 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapalphaonly-mov @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A nb_frames=1 nb_read_frames=N/A nb_read_packets=1 -extradata_hash=adler32:00000001 DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0 diff --git a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov index 16923e8684..70e7cdc943 100644 --- a/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov +++ b/tests/ref/fate/hapqa-extract-nosnappy-to-hapq-mov @@ -50,7 +50,6 @@ bits_per_raw_sample=N/A nb_frames=1 nb_read_frames=N/A nb_read_packets=1 -extradata_hash=adler32:00000001 DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0