From f4cee8850dd06852ac87ab2c1cf85588ee52ad3d Mon Sep 17 00:00:00 2001 From: difcsi Date: Fri, 14 Nov 2025 06:27:01 +0000 Subject: [PATCH] fix: vector OOB access causing assertion violation crashes --- include/srk31/closure.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/srk31/closure.hpp b/include/srk31/closure.hpp index 287dbbf..274ed88 100644 --- a/include/srk31/closure.hpp +++ b/include/srk31/closure.hpp @@ -194,7 +194,7 @@ struct ffi_closure_s /* ffi_abi abi */ FFI_DEFAULT_ABI, /*unsigned int nargs */ p_atypes->size(), /* ffi_type *rtype */ ffi_type_s::t(), - /* ffi_type **atypes */ &(*p_atypes)[0] + /* ffi_type **atypes */ p_atypes->empty() ? nullptr : &(*p_atypes)[0] ); if (status != FFI_OK) throw 1; // FIXME: better thing to throw (or return null?) status = ffi_prep_closure(closure, &*p_cif, &the_fun, obj); @@ -235,7 +235,7 @@ class myclass } o; int main(void) -{ +{ffi_prep_cif /* An ffi_closure is basically * char tramp[FFI_TRAMPOLINE_SIZE]; * ffi_cif *cif;