lua54/luabugs4.patch
Matej Cepl ce441f7720 - Update to 5.4.5:
- this is a bug-fix release.
  - Lua 5.4.5 also contains several internal improvements and
    includes a revised reference manual
- Remove upstreamed patches:
  - luabugs1.patch
  - luabugs10.patch
  - luabugs11.patch
  - luabugs2.patch
  - luabugs6.patch
  - luabugs7.patch
  - luabugs8.patch
  - luabugs9.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=72
2023-04-30 22:05:58 +00:00

28 lines
1.1 KiB
Diff

From 42d40581dd919fb134c07027ca1ce0844c670daf Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 20 May 2022 13:14:33 -0300
Subject: [PATCH] Save stack space while handling errors
Because error handling (luaG_errormsg) uses slots from EXTRA_STACK,
and some errors can recur (e.g., string overflow while creating an
error message in 'luaG_runerror', or a C-stack overflow before calling
the message handler), the code should use stack slots with parsimony.
This commit fixes the bug "Lua-stack overflow when C stack overflows
while handling an error".
---
src/lvm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -674,7 +674,7 @@ void luaV_concat (lua_State *L, int tota
setsvalue2s(L, top - n, ts); /* create result */
}
total -= n - 1; /* got 'n' strings to create one new */
- L->top.p -= n - 1; /* popped 'n' strings and pushed one */
+ L->top = top - (n - 1); /* popped 'n' strings and pushed one */
} while (total > 1); /* repeat until only 1 result left */
}