From d04f78b5635e84a9099f2b0105562b87ba75f2cd Mon Sep 17 00:00:00 2001 From: James Zern Date: Mon, 11 Apr 2022 11:08:12 -0700 Subject: [PATCH] rate_hist,show_histogram: fix crash w/0 buckets this can occur if 0 frames are encoded, e.g., due to --skip see also: https://crbug.com/aomedia/3243 Change-Id: I791d5ad6611dbcb60d790e6b705298328ec48126 --- rate_hist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rate_hist.c b/rate_hist.c index d10e754fe..947950d48 100644 --- a/rate_hist.c +++ b/rate_hist.c @@ -196,7 +196,9 @@ static void show_histogram(const struct hist_bucket *bucket, int buckets, int width1, width2; int i; + if (!buckets) return; assert(bucket != NULL); + assert(buckets > 0); switch ((int)(log(bucket[buckets - 1].high) / log(10)) + 1) { case 1: