From 69ce580970550bf4bfaa60646a61e511df90f71e Mon Sep 17 00:00:00 2001 From: Takase <20792268+takase1121@users.noreply.github.com> Date: Wed, 4 Jan 2023 23:46:08 +0800 Subject: [PATCH] do not allow users to create an empty font group (#1303) --- src/api/renderer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/renderer.c b/src/api/renderer.c index 261fc26a..ae2c7ae0 100644 --- a/src/api/renderer.c +++ b/src/api/renderer.c @@ -145,6 +145,8 @@ static int f_font_group(lua_State* L) { luaL_checktype(L, 1, LUA_TTABLE); table_size = lua_rawlen(L, 1); + if (table_size <= 0) + return luaL_error(L, "failed to create font group: table is empty"); if (table_size > FONT_FALLBACK_MAX) return luaL_error(L, "failed to create font group: table size too large");