From 12fb2eea33b45d6ed720e3f69b73cbfc23e5a379 Mon Sep 17 00:00:00 2001 From: fesil Date: Thu, 18 Jul 2024 20:44:23 +0800 Subject: [PATCH] fix crash --- CMakeLists.txt | 6 ++++-- src/lj_parse.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a200eaec..0e3e0c75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,11 +76,13 @@ if (LUAJIT_ENABLE_FSANITIZE) if (CMAKE_BUILD_TYPE STREQUAL "Debug") message(STATUS "luajit debug mode") add_definitions(-DLUA_USE_APICHECK -DLUA_USE_ASSERT -DLUAJIT_USE_SYSMALLOC) - if (MSVC) + if (NOT MSVC) add_link_options(-fsanitize=address) add_compile_options(-fsanitize=address) + else() + add_link_options(/fsanitize=address) + add_compile_options(/fsanitize=address) endif() - endif() endif() CHECK_TYPE_SIZE("void*" SIZEOF_VOID_P) diff --git a/src/lj_parse.c b/src/lj_parse.c index 67d33ca8..894e4e56 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c @@ -1761,6 +1761,8 @@ static void expr_table(LexState *ls, ExpDesc *e) lex_check(ls, '{'); #if LJ_DS_PARSER_TABLE_PATCH GCtab* tmp_t = lj_tab_new(fs->L, 0, 0); + settabV(fs->L, fs->L->top, tmp_t); + incr_top(fs->L); int tmp_indx = 0; #endif while (ls->tok != '}') { @@ -1871,6 +1873,7 @@ static void expr_table(LexState *ls, ExpDesc *e) } lj_gc_check(fs->L); } + fs->L->top--; } /* Parse function parameters. */