From patchwork Tue Aug 22 16:34:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4797 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.137.29 with SMTP id o29csp1035261jaj; Tue, 22 Aug 2017 09:35:11 -0700 (PDT) X-Received: by 10.223.144.99 with SMTP id h90mr933435wrh.114.1503419710921; Tue, 22 Aug 2017 09:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503419710; cv=none; d=google.com; s=arc-20160816; b=ODKBrP5M10nmqCiNLo0qy6vi0JModaW/IyjWA8XYPHJ+NqRLlMUyKkG4mul9ZewaGi 84LRtj2cLtD1YBqHlusxyOvXM2OeD18QFGlQJ7Q/i91kbG47/WG3ipYfpOUqU2RHI6RN oobE2nKtJKTtBe8KbLxROEgK5X+pzaka6Emex2CAXfSdJqwugFyAmTsjyV5MU/1fhtc8 l1o+DNv5FeP9IVUS5y18Gwnu5Z9aeSAVcJ2TDNsqJ2zGUl7Byoca6zEbw2P4ncMA01vr yFVUiUDUhOKCAbZSIF2J5Gp+m4JgDiKEfKjfralfvhhAs3nClzwkaWGW15Ooqm/Y4bHj SXxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=D+jsvJCYqzNrmGTryiFL6+qvU6jTyJ07oPhcyowLcpI=; b=T4ifkHvAa/4gbuIzx+4Sz24KPq4tm/EvVkG1TGWwEirfZxLNKJ/ah++T6wgNJgVMB3 OirwYKKVXO1m2HNY/bkHPD8OAtqH0/AZyf4/xbvwED/MzaLvtTI9YzVa3i3DYr1u02+n GtvlsURqrKD7v8njIiYEIMulQ0CFrSZ99YIT5TA5CiuAc3jbX7BpzdrTGzmGuxeyUZ1X cQI6mGbLhQZsvrtBxhQJivZ9dRJKe4+516F2Np2gvC74tJ/GHHXelrkvlCRUJWWO8iC+ eEKO5NPr3L2uhAfjz+dd0OZiOzXcq5O7YQWz9LSOfTP/7AECxo6wF3P2y7D3ACyI6G8j z9OQ== 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 i90si177371wmh.239.2017.08.22.09.35.10; Tue, 22 Aug 2017 09:35:10 -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 0D0DB689C69; Tue, 22 Aug 2017 19:34:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-3.mx.upcmail.net (vie01a-qmta-pe01-3.mx.upcmail.net [62.179.121.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD78A689C3C for ; Tue, 22 Aug 2017 19:34:43 +0300 (EEST) Received: from [172.31.218.49] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dkC8h-0005yO-0F for ffmpeg-devel@ffmpeg.org; Tue, 22 Aug 2017 18:34:51 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dkC8b-0008D8-OW for ffmpeg-devel@ffmpeg.org; Tue, 22 Aug 2017 18:34:45 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 0Gac1w0100S5wYM01GadQ5; Tue, 22 Aug 2017 18:34:37 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 22 Aug 2017 18:34:35 +0200 Message-Id: <20170822163436.10354-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH 1/2] ffprobe: Fix null pointer dereference with color primaries 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Found-by: AD-lab of venustech Signed-off-by: Michael Niedermayer --- ffprobe.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 50d7c1a777..d4bdd9c099 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -1925,6 +1925,16 @@ static void print_pkt_side_data(WriterContext *w, writer_print_section_footer(w); } +static void print_primaries(WriterContext *w, enum AVColorPrimaries color_primaries) +{ + const char *val = av_color_primaries_name(color_primaries); + if (!val || color_primaries == AVCOL_PRI_UNSPECIFIED) { + print_str_opt("color_primaries", "unknown"); + } else { + print_str("color_primaries", val); + } +} + static void clear_log(int need_lock) { int i; @@ -2116,10 +2126,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, else print_str_opt("color_space", av_color_space_name(frame->colorspace)); - if (frame->color_primaries != AVCOL_PRI_UNSPECIFIED) - print_str("color_primaries", av_color_primaries_name(frame->color_primaries)); - else - print_str_opt("color_primaries", av_color_primaries_name(frame->color_primaries)); + print_primaries(w, frame->color_primaries); if (frame->color_trc != AVCOL_TRC_UNSPECIFIED) print_str("color_transfer", av_color_transfer_name(frame->color_trc)); @@ -2516,10 +2523,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id else print_str_opt("color_transfer", av_color_transfer_name(par->color_trc)); - if (par->color_primaries != AVCOL_PRI_UNSPECIFIED) - print_str("color_primaries", av_color_primaries_name(par->color_primaries)); - else - print_str_opt("color_primaries", av_color_primaries_name(par->color_primaries)); + print_primaries(w, par->color_primaries); if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED) print_str("chroma_location", av_chroma_location_name(par->chroma_location));