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 | 552b75c3572b11e37581c2c5ac359319af6941f5 (patch) | |
tree | eb4097db6adbf45094e753bdbcc42d92f52a0749 | |
parent | 0f5fbbe6f79823161ca3d921255dd0f234868e02 (diff) | |
download | txr-552b75c3572b11e37581c2c5ac359319af6941f5.tar.gz txr-552b75c3572b11e37581c2c5ac359319af6941f5.tar.bz2 txr-552b75c3572b11e37581c2c5ac359319af6941f5.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; } |