diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-07-25 21:57:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-07-25 21:57:28 -0700 |
commit | b7bd6421c9b69711eea1848dcc11860482571ea0 (patch) | |
tree | eb4097db6adbf45094e753bdbcc42d92f52a0749 | |
parent | 7b1613b5cfd5f75d719c91431ebcedb83dc675f0 (diff) | |
download | txr-b7bd6421c9b69711eea1848dcc11860482571ea0.tar.gz txr-b7bd6421c9b69711eea1848dcc11860482571ea0.tar.bz2 txr-b7bd6421c9b69711eea1848dcc11860482571ea0.zip |
hash: out of bound array access in hash-iter-peek.
* hash.c (hash_iter_peek): The loop here must be a top-of-test
while loop, not a bottom-test do loop. In the chained hashing
implementation, this was a do loop, but it also had a test
with a break for the index.
-rw-r--r-- | hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1341,11 +1341,11 @@ val hash_iter_peek(struct hash_iter *hi) if (!h) return nil; - do { + while (index <= mask) { val cell = hi->table->v.vec[index++]; if (cell) return cell; - } while (index <= mask); + } return nil; } |