From 1cc82bbb8b23f79b7f3097e8143fc2f705237ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Wed, 26 Dec 2018 17:27:00 +0100 Subject: [PATCH] eccdata: Check that table size is at least 2. Intended to silence warning from the clang static analyzer. --- ChangeLog | 4 ++++ eccdata.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6af7fea..aa3daeb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-12-26 Niels Möller <nisse@lysator.liu.se> + * eccdata.c (ecc_pippenger_precompute): Check that table size is + at least 2. Intended to silence warning from the clang static + analyzer. + * configure.ac: Bump package version to 3.5. (LIBNETTLE_MAJOR): Bump major number, now 7. (LIBHOGWEED_MAJOR): Bump major number, now 5. diff --git a/eccdata.c b/eccdata.c index 51ecde35..8aa57e06 100644 --- a/eccdata.c +++ b/eccdata.c @@ -650,6 +650,12 @@ ecc_pippenger_precompute (struct ecc_curve *ecc, unsigned k, unsigned c) unsigned M = ecc_table_size (ecc->bit_size, k, c); unsigned i, j; + if (M < 2) + { + fprintf (stderr, "Invalid parameters, implies M = %u\n", M); + exit (EXIT_FAILURE); + } + if (M == ecc_table_size (ecc->bit_size, k-1, c)) fprintf(stderr, "warn: Parameters k = %u, c = %d are suboptimal, could use smaller k\n", -- GitLab