From f8df95d146c99ee0228a982e5c0e0eb885d2cb3d Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 23 Sep 2026 22:29:39 +0800 Subject: [PATCH] Common (Lua): don't segfault when formating a null string Fixes #2608 --- src/common/impl/format.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/impl/format.c b/src/common/impl/format.c index cf5a5b695..b00fb2130 100644 --- a/src/common/impl/format.c +++ b/src/common/impl/format.c @@ -205,7 +205,11 @@ static bool parseLuaString(FFstrbuf* buffer, const char* script, uint32_t script lua_pushboolean(L, *(bool*) arg->value); break; case FF_ARG_TYPE_STRING: - lua_pushlstring(L, (const char*) arg->value, strlen((const char*) arg->value)); + if (!arg->value) { + lua_pushlstring(L, "", 0); + } else { + lua_pushlstring(L, (const char*) arg->value, strlen((const char*) arg->value)); + } break; case FF_ARG_TYPE_STRBUF: { const FFstrbuf* sb = (const FFstrbuf*) arg->value;