We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2eaa5d + a695454 commit 5236393Copy full SHA for 5236393
src/core/ev.c
@@ -3015,7 +3015,8 @@ static JanetEVGenericMessage janet_go_thread_subr(JanetEVGenericMessage args) {
3015
uint32_t count1;
3016
memcpy(&count1, nextbytes, sizeof(count1));
3017
size_t count = (size_t) count1;
3018
- if (count > (endbytes - nextbytes) * sizeof(JanetCFunRegistry)) {
+ /* Use division to avoid overflowing size_t */
3019
+ if (count > (endbytes - nextbytes - sizeof(count1)) / sizeof(JanetCFunRegistry)) {
3020
janet_panic("thread message invalid");
3021
}
3022
janet_vm.registry_count = count;
0 commit comments