nixpkgs/pkgs/development/interpreters/lua-5/5.1.0004-Fix-stack-overflow-in-vararg-functions.patch
Benjamin Hipple 17f50018c0 lua5.1: fix broken source fetch (#40748)
The upstream src URL for the patch appears to no longer exist. Per discussion in
https://github.com/NixOS/nixpkgs/issues/39927, the upstream URL is not stable,
so this commit inlines the patch in the nixpkgs src tree.
2018-05-19 17:30:04 +02:00

22 lines
648 B
Diff

From: Enrico Tassi <gareuselesinge@debian.org>
Date: Tue, 26 Aug 2014 16:20:55 +0200
Subject: Fix stack overflow in vararg functions
---
src/ldo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ldo.c b/src/ldo.c
index d1bf786..30333bf 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
CallInfo *ci;
StkId st, base;
Proto *p = cl->p;
- luaD_checkstack(L, p->maxstacksize);
+ luaD_checkstack(L, p->maxstacksize + p->numparams);
func = restorestack(L, funcr);
if (!p->is_vararg) { /* no varargs? */
base = func + 1;