diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-09-22 16:57:11 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-09-22 16:57:11 +0300 |
commit | da83b6857bf0a67b15fc75d31a0b6802ac9baffe (patch) | |
tree | 399e9f1ec800b5405f9b494060481a8420480caf /cint_array.c | |
parent | e149eb882355f427d43928324145c971a0562c5e (diff) | |
parent | 8aa14c5f3cf78f90b589785a9ffe5f7f02050b37 (diff) | |
download | egawk-da83b6857bf0a67b15fc75d31a0b6802ac9baffe.tar.gz egawk-da83b6857bf0a67b15fc75d31a0b6802ac9baffe.tar.bz2 egawk-da83b6857bf0a67b15fc75d31a0b6802ac9baffe.zip |
Merge branch 'master' into comment
Diffstat (limited to 'cint_array.c')
-rw-r--r-- | cint_array.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cint_array.c b/cint_array.c index 1d34c2f7..3945e6e7 100644 --- a/cint_array.c +++ b/cint_array.c @@ -150,10 +150,14 @@ cint_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED) { if (symbol == NULL) { long newval; + size_t nelems = (sizeof(power_two_table) / sizeof(power_two_table[0])); /* check relevant environment variables */ if ((newval = getenv_long("NHAT")) > 1 && newval < INT32_BIT) NHAT = newval; + /* don't allow overflow off the end of the table */ + if (NHAT >= nelems) + NHAT = nelems - 2; THRESHOLD = power_two_table[NHAT + 1]; } else null_array(symbol); |