luajit: fix several CVEs
PATCH 1/1 luajit: fix several CVEs
From: Changqing Li <[email protected]>
fix CVE-2024-25176, CVE-2024-25177, CVE-2024-25178
For apply CVE-2024-25178-0003.patch more smoothly, CVE-2024-25178-0001.patch and CVE-2024-25178-0002.patch is backported.
Signed-off-by Changqing Li <[email protected]>
--- .../luajit/luajit/CVE-2024-25176.patch | 32 ++++ .../luajit/luajit/CVE-2024-25177.patch | 44 +++++ .../luajit/luajit/CVE-2024-25178-0001.patch | 28 +++ .../luajit/luajit/CVE-2024-25178-0002.patch | 49 ++++++ .../luajit/luajit/CVE-2024-25178-0003.patch | 163 ++++++++++++++++++ meta-oe/recipes-devtools/luajit/luajit_git.bb | 5 + 6 files changed, 321 insertions(+) create mode 100644 meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25176.patch create mode 100644 meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25177.patch create mode 100644 meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0001.patch create mode 100644 meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0002.patch create mode 100644 meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0003.patch
meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25176.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 810bf18ff0ddbae9b2ceb30dd8b9c901cc634d1f Mon Sep 17 00:00:00 2001 +From: Changqing Li <[email protected]> +Date: Tue, 5 Aug 2025 14:49:06 +0800 +Subject: [PATCH] Fix zero stripping in %g number formatting. + +Reported by pwnhacker0x18. #1149 + +CVE: CVE-2024-25176 +Upstream-Status: Backport [https://github.com/LuaJIT/LuaJIT/commit/343ce0edaf3906a62022936175b2f5410024cbfc] + +Signed-off-by: Changqing Li <[email protected]> +--- + src/lj_strfmt_num.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/lj_strfmt_num.c b/src/lj_strfmt_num.c +index 3c60695c..41214894 100644 +--- a/src/lj_strfmt_num.c ++++ b/src/lj_strfmt_num.c +@@ -454,7 +454,8 @@ static char *lj_strfmt_wfnum(SBuf *sb, SFormat sf, lua_Number n, char *p) + prec--; + if (!i) { + if (ndlo == ndhi) { prec = 0; break; } +- lj_strfmt_wuint9(tail, nd[++ndlo]); ++ ndlo = (ndlo + 1) & 0x3f; ++ lj_strfmt_wuint9(tail, nd[ndlo]); + i = 9; + } + } +-- +2.34.1 +
meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25177.patch new file +44 -0
44 lines not on this page · raw message
meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0001.patch new file +28 -0
@@ -0,0 +1,28 @@ +From d4fd9f2939645eb20616ced3bbffba609c1eeac6 Mon Sep 17 00:00:00 2001 +From: Mike Pall <mike> +Date: Wed, 9 Nov 2022 11:01:41 +0100 +Subject: [PATCH 1/3] Ensure correct stack top for OOM error message. + +Reported by Sergey Kaplun. + +Upstream-Status: Backport [https://github.com/LuaJIT/LuaJIT/commit/ca8d3257bb44e42100c7910c47dcdcf01f494187] +Signed-off-by: Changqing Li <[email protected]> +--- + src/lj_err.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/lj_err.c b/src/lj_err.c +index 563c7706..283c3d18 100644 +--- a/src/lj_err.c ++++ b/src/lj_err.c +@@ -777,6 +777,7 @@ LJ_NOINLINE void lj_err_mem(lua_State *L) + { + if (L->status == LUA_ERRERR+1) /* Don't touch the stack during lua_open. */ + lj_vm_unwind_c(L->cframe, LUA_ERRMEM); ++ if (curr_funcisL(L)) L->top = curr_topL(L); + setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRMEM)); + lj_err_throw(L, LUA_ERRMEM); + } +-- +2.34.1 +
meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0002.patch new file +49 -0
49 lines not on this page · raw message
meta-oe/recipes-devtools/luajit/luajit/CVE-2024-25178-0003.patch new file +163 -0
163 lines not on this page · raw message
meta-oe/recipes-devtools/luajit/luajit_git.bb +5 -0
@@ -6,6 +6,11 @@ HOMEPAGE = "http://luajit.org" SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1 \ file://0001-Do-not-strip-automatically-this-leaves-the-stripping.patch \ file://clang.patch \ + file://CVE-2024-25176.patch \ + file://CVE-2024-25177.patch \ + file://CVE-2024-25178-0001.patch \ + file://CVE-2024-25178-0002.patch \ + file://CVE-2024-25178-0003.patch \ " # Set PV to a version tag and date (YYMMDD) associated with SRCREV if it is later.
Signature · 1 line
2.34.1