From a49555fe467ca8c31e5fa501b666186016c28b03 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 20 Feb 2023 18:39:52 +0100 Subject: [PATCH] Fail with wrong thread execute payload Otherwise it produces a segfault. --- src/emu/ovni/event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/emu/ovni/event.c b/src/emu/ovni/event.c index 4ec935a..f815f8f 100644 --- a/src/emu/ovni/event.c +++ b/src/emu/ovni/event.c @@ -18,6 +18,11 @@ pre_thread_execute(struct emu *emu, struct thread *th) return -1; } + if (emu->ev->payload_size < 4) { + err("missing payload in thread %d execute event", th->tid); + return -1; + } + int cpuid = emu->ev->payload->i32[0]; struct cpu *cpu = loom_find_cpu(emu->loom, cpuid);