summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2022-04-11 11:08:12 -0700
committerJames Zern <jzern@google.com>2022-04-11 11:08:12 -0700
commitd04f78b5635e84a9099f2b0105562b87ba75f2cd (patch)
tree97ddf2835f0d120e044b06467fd87503348ef2f8
parent6e1b7c6c14fea5d972bdd1162b51fc93942222a2 (diff)
downloadlibvpx-d04f78b5635e84a9099f2b0105562b87ba75f2cd.tar
libvpx-d04f78b5635e84a9099f2b0105562b87ba75f2cd.tar.gz
libvpx-d04f78b5635e84a9099f2b0105562b87ba75f2cd.tar.bz2
libvpx-d04f78b5635e84a9099f2b0105562b87ba75f2cd.zip
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
-rw-r--r--rate_hist.c2
1 files changed, 2 insertions, 0 deletions
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: