Version in base suite: 5.3.3-1.1 Base version: lua5.3_5.3.3-1.1 Target version: lua5.3_5.3.3-1.1+deb11u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/l/lua5.3/lua5.3_5.3.3-1.1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/l/lua5.3/lua5.3_5.3.3-1.1+deb11u1.dsc changelog | 10 +++++++ patches/CVE-2019-6706.patch | 57 +++++++++++++++++++++++++++++++++++++++++++ patches/CVE-2020-24370.patch | 39 +++++++++++++++++++++++++++++ patches/series | 2 + salsa-ci.yml | 9 ++++++ 5 files changed, 117 insertions(+) diff -Nru lua5.3-5.3.3/debian/changelog lua5.3-5.3.3/debian/changelog --- lua5.3-5.3.3/debian/changelog 2018-12-28 19:10:13.000000000 +0000 +++ lua5.3-5.3.3/debian/changelog 2023-06-22 20:03:38.000000000 +0000 @@ -1,3 +1,13 @@ +lua5.3 (5.3.3-1.1+deb11u1) bullseye; urgency=high + + * Non-maintainer upload. + * Fix CVE-2019-6706: Use after free in lua_upvaluejoin in lapi.c. (Closes: + #920321) + * Fix CVE-2020-24370: Segmentation fault in getlocal and setlocal functions + in ldebug.c. (Closes: #988734) + + -- Guilhem Moulin Thu, 22 Jun 2023 22:03:38 +0200 + lua5.3 (5.3.3-1.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru lua5.3-5.3.3/debian/patches/CVE-2019-6706.patch lua5.3-5.3.3/debian/patches/CVE-2019-6706.patch --- lua5.3-5.3.3/debian/patches/CVE-2019-6706.patch 1970-01-01 00:00:00.000000000 +0000 +++ lua5.3-5.3.3/debian/patches/CVE-2019-6706.patch 2023-06-22 20:03:38.000000000 +0000 @@ -0,0 +1,57 @@ +From: Roberto Ierusalimschy +Date: Wed, 27 Mar 2019 14:30:12 -0300 +Subject: Fixed bug in 'lua_upvaluejoin' + +Bug-fix: joining an upvalue with itself could cause a use-after-free +crash. + +Origin: https://github.com/lua/lua/commit/89aee84cbc9224f638f3b7951b306d2ee8ecb71e +Bug: http://lua-users.org/lists/lua-l/2019-01/msg00039.html +Bug-Debian: https://security-tracker.debian.org/tracker/CVE-2019-6706 +Bug-Debian: https://bugs.debian.org/920321 +--- + src/lapi.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/lapi.c b/src/lapi.c +index c9455a5..86eac00 100644 +--- a/src/lapi.c ++++ b/src/lapi.c +@@ -1253,13 +1253,12 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + } + + +-static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { ++static UpVal **getupvalref (lua_State *L, int fidx, int n) { + LClosure *f; + StkId fi = index2addr(L, fidx); + api_check(L, ttisLclosure(fi), "Lua function expected"); + f = clLvalue(fi); + api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); +- if (pf) *pf = f; + return &f->upvals[n - 1]; /* get its upvalue pointer */ + } + +@@ -1268,7 +1267,7 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { + StkId fi = index2addr(L, fidx); + switch (ttype(fi)) { + case LUA_TLCL: { /* lua closure */ +- return *getupvalref(L, fidx, n, NULL); ++ return *getupvalref(L, fidx, n); + } + case LUA_TCCL: { /* C closure */ + CClosure *f = clCvalue(fi); +@@ -1285,9 +1284,10 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { + + LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, + int fidx2, int n2) { +- LClosure *f1; +- UpVal **up1 = getupvalref(L, fidx1, n1, &f1); +- UpVal **up2 = getupvalref(L, fidx2, n2, NULL); ++ UpVal **up1 = getupvalref(L, fidx1, n1); ++ UpVal **up2 = getupvalref(L, fidx2, n2); ++ if (*up1 == *up2) ++ return; + luaC_upvdeccount(L, *up1); + *up1 = *up2; + (*up1)->refcount++; diff -Nru lua5.3-5.3.3/debian/patches/CVE-2020-24370.patch lua5.3-5.3.3/debian/patches/CVE-2020-24370.patch --- lua5.3-5.3.3/debian/patches/CVE-2020-24370.patch 1970-01-01 00:00:00.000000000 +0000 +++ lua5.3-5.3.3/debian/patches/CVE-2020-24370.patch 2023-06-22 20:03:38.000000000 +0000 @@ -0,0 +1,39 @@ +From: Roberto Ierusalimschy +Date: Mon, 3 Aug 2020 16:25:28 -0300 +Subject: Fixed bug: Negation overflow in getlocal/setlocal + +Origin: https://github.com/lua/lua/commit/b5bc89846721375fe30772eb8c5ab2786f362bf9 +Bug: http://lua-users.org/lists/lua-l/2020-07/msg00324.html +Bug-Debian: https://security-tracker.debian.org/tracker/CVE-2020-24370 +Bug-Debian: https://bugs.debian.org/988734 +--- + src/ldebug.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/ldebug.c b/src/ldebug.c +index e499ee3..596bed2 100644 +--- a/src/ldebug.c ++++ b/src/ldebug.c +@@ -132,10 +132,11 @@ static const char *upvalname (Proto *p, int uv) { + + static const char *findvararg (CallInfo *ci, int n, StkId *pos) { + int nparams = clLvalue(ci->func)->p->numparams; +- if (n >= cast_int(ci->u.l.base - ci->func) - nparams) ++ int nvararg = cast_int(ci->u.l.base - ci->func) - nparams; ++ if (n <= -nvararg) + return NULL; /* no such vararg */ + else { +- *pos = ci->func + nparams + n; ++ *pos = ci->func + nparams - n; + return "(*vararg)"; /* generic name for any vararg */ + } + } +@@ -147,7 +148,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n, + StkId base; + if (isLua(ci)) { + if (n < 0) /* access to vararg values? */ +- return findvararg(ci, -n, pos); ++ return findvararg(ci, n, pos); + else { + base = ci->u.l.base; + name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); diff -Nru lua5.3-5.3.3/debian/patches/series lua5.3-5.3.3/debian/patches/series --- lua5.3-5.3.3/debian/patches/series 2018-12-01 03:39:23.000000000 +0000 +++ lua5.3-5.3.3/debian/patches/series 2023-06-22 20:03:38.000000000 +0000 @@ -2,3 +2,5 @@ 0002-lua-modules-paths.patch 0003-extern_C.patch 0004-Fix-invalid-pointer-conversions.patch +CVE-2019-6706.patch +CVE-2020-24370.patch diff -Nru lua5.3-5.3.3/debian/salsa-ci.yml lua5.3-5.3.3/debian/salsa-ci.yml --- lua5.3-5.3.3/debian/salsa-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ lua5.3-5.3.3/debian/salsa-ci.yml 2023-06-22 20:03:38.000000000 +0000 @@ -0,0 +1,9 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml + +variables: + RELEASE: 'bullseye' + SALSA_CI_DISABLE_REPROTEST: 1 + SALSA_CI_DISABLE_LINTIAN: 1 + SALSA_CI_DISABLE_PIUPARTS: 1