aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/common/ChangeLog5
-rw-r--r--sim/common/sim-options.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 61149e2..ed4d9f7 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-24 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-options.c (ARG_HASH_SIZE): Increase to 256.
+ (sim_parse_args): Call SIM_ASSERT.
+
2021-04-22 Tom Tromey <tom@tromey.com>
* sim-utils.c: Update includes.
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index d4434cf..ab95984 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -416,7 +416,7 @@ standard_install (SIM_DESC sd)
/* Return non-zero if arg is a duplicate argument.
If ARG is NULL, initialize. */
-#define ARG_HASH_SIZE 97
+#define ARG_HASH_SIZE 256
#define ARG_HASH(a) ((256 * (unsigned char) a[0] + (unsigned char) a[1]) % ARG_HASH_SIZE)
static int
@@ -478,6 +478,9 @@ sim_parse_args (SIM_DESC sd, char * const *argv)
for (opt = ol->options; OPTION_VALID_P (opt); ++opt)
++num_opts;
+ /* We build a hash table of all options, so make sure they all fit. */
+ SIM_ASSERT (num_opts <= ARG_HASH_SIZE);
+
/* Initialize duplicate argument checker. */
(void) dup_arg_p (NULL);