From 1faf4155aba0143757b169a888fbf081b1ad3c07 Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Fri, 15 May 2020 11:11:36 -0400 Subject: [PATCH] let's not call lh_table_resize with INT_MAX That would be bad. --- linkhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linkhash.c b/linkhash.c index b021ef1..8c1eadb 100644 --- a/linkhash.c +++ b/linkhash.c @@ -584,7 +584,7 @@ int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, con { /* Avoid signed integer overflow with large tables. */ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2); - if (t->size == INT_MAX || lh_table_resize(t, new_size) != 0) + if (new_size == INT_MAX || lh_table_resize(t, new_size) != 0) return -1; }