diff --git a/src/system/kernel/arch/x86/64/thread.cpp b/src/system/kernel/arch/x86/64/thread.cpp index e50c3a8fa2..f767ca0f16 100644 --- a/src/system/kernel/arch/x86/64/thread.cpp +++ b/src/system/kernel/arch/x86/64/thread.cpp @@ -144,7 +144,11 @@ arch_thread_init(kernel_args* args) // Save one global valid FPU state; it will be copied in the arch dependent // part of each new thread. if (gHasXsave || gHasXsavec) { - ASSERT(gFPUSaveLength <= sizeof(sInitialState.fpu_state)); + if (gFPUSaveLength > sizeof(sInitialState.fpu_state)) { + panic("XSAVE FPU context is larger than allowed " + "(need at least %" B_PRIu64 " bytes)", gFPUSaveLength); + return B_ERROR; + } memset(sInitialState.fpu_state, 0, gFPUSaveLength); if (gHasXsavec) { asm volatile (