Add payload size checks for affinity events

This commit is contained in:
Rodrigo Arias 2023-03-21 10:29:01 +01:00 committed by Rodrigo Arias Mallo
parent 9b209fab20
commit 7b0d446b02

View File

@ -219,6 +219,11 @@ pre_affinity_set(struct emu *emu)
return -1; return -1;
} }
if (emu->ev->payload_size != 4) {
err("unexpected payload size %d", emu->ev->payload_size);
return -1;
}
/* Migrate current cpu to the one at index */ /* Migrate current cpu to the one at index */
int index = emu->ev->payload->i32[0]; int index = emu->ev->payload->i32[0];
struct cpu *newcpu = loom_get_cpu(emu->loom, index); struct cpu *newcpu = loom_get_cpu(emu->loom, index);
@ -250,6 +255,11 @@ pre_affinity_set(struct emu *emu)
static int static int
pre_affinity_remote(struct emu *emu) pre_affinity_remote(struct emu *emu)
{ {
if (emu->ev->payload_size != 8) {
err("unexpected payload size %d", emu->ev->payload_size);
return -1;
}
int32_t index = emu->ev->payload->i32[0]; int32_t index = emu->ev->payload->i32[0];
int32_t tid = emu->ev->payload->i32[1]; int32_t tid = emu->ev->payload->i32[1];