1
0
mirror of https://github.com/janet-lang/janet synced 2025-06-03 07:04:12 +00:00

Merge pull request #1593 from agent-kilo/thread-message-size-check

Try to fix cfun registry size check for cross-thread messages
This commit is contained in:
Calvin Rose 2025-05-08 17:00:22 -05:00 committed by GitHub
commit 523639362c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3015,7 +3015,8 @@ static JanetEVGenericMessage janet_go_thread_subr(JanetEVGenericMessage args) {
uint32_t count1;
memcpy(&count1, nextbytes, sizeof(count1));
size_t count = (size_t) count1;
if (count > (endbytes - nextbytes) * sizeof(JanetCFunRegistry)) {
/* Use division to avoid overflowing size_t */
if (count > (endbytes - nextbytes - sizeof(count1)) / sizeof(JanetCFunRegistry)) {
janet_panic("thread message invalid");
}
janet_vm.registry_count = count;