Skip to content

Commit 88c42ff

Browse files
committed
Address fuzzer issue with undefined behavior on memory overflow.
1 parent 0e0cbc3 commit 88c42ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/core/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ int32_t janet_tablen(int32_t n) {
277277
n |= n >> 4;
278278
n |= n >> 8;
279279
n |= n >> 16;
280-
return n + 1;
280+
return n == INT32_MAX ? INT32_MAX : n + 1;
281281
}
282282

283283
/* Avoid some undefined behavior that was common in the code base. */

0 commit comments

Comments
 (0)