Limit the minimal size of bh_hashmap (#2073)

Limit the minimal size of bh_hashmap to avoid creating hashmap with size 0,
and `divide by zero` when calling bh_hash_map_find.

Reported by #2008.
This commit is contained in:
Wenyong Huang
2023-03-28 14:50:31 +08:00
committed by GitHub
parent 0a7994ac0a
commit 8ee8ab3099
2 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,9 @@
extern "C" {
#endif
/* Minimum initial size of hash map */
#define HASH_MAP_MIN_SIZE 4
/* Maximum initial size of hash map */
#define HASH_MAP_MAX_SIZE 65536