29 lines
967 B
Diff
29 lines
967 B
Diff
|
From snapshot 6.1-20191012
|
||
|
|
||
|
diff --git a/ncurses/tinfo/comp_hash.c b/ncurses/tinfo/comp_hash.c
|
||
|
index 21f165ca..a62d38f9 100644
|
||
|
--- a/ncurses/tinfo/comp_hash.c
|
||
|
+++ b/ncurses/tinfo/comp_hash.c
|
||
|
@@ -63,7 +63,9 @@ _nc_find_entry(const char *string,
|
||
|
|
||
|
hashvalue = data->hash_of(string);
|
||
|
|
||
|
- if (data->table_data[hashvalue] >= 0) {
|
||
|
+ if (hashvalue >= 0
|
||
|
+ && (unsigned) hashvalue < data->table_size
|
||
|
+ && data->table_data[hashvalue] >= 0) {
|
||
|
|
||
|
real_table = _nc_get_table(termcap);
|
||
|
ptr = real_table + data->table_data[hashvalue];
|
||
|
@@ -96,7 +98,9 @@ _nc_find_type_entry(const char *string,
|
||
|
const HashData *data = _nc_get_hash_info(termcap);
|
||
|
int hashvalue = data->hash_of(string);
|
||
|
|
||
|
- if (data->table_data[hashvalue] >= 0) {
|
||
|
+ if (hashvalue >= 0
|
||
|
+ && (unsigned) hashvalue < data->table_size
|
||
|
+ && data->table_data[hashvalue] >= 0) {
|
||
|
const struct name_table_entry *const table = _nc_get_table(termcap);
|
||
|
|
||
|
ptr = table + data->table_data[hashvalue];
|