1 Star 0 Fork 25

邓雨雨01/redis5

forked from src-openEuler/redis5 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2022-24736.patch 2.51 KB
一键复制 编辑 原始数据 按行查看 历史
dengyuyu01 提交于 2022-05-19 10:25 . fix CVE-2022-24736
diff -Naru redis-5.0.14/deps/lua/src/ldebug.c redis-5.0.14-new/deps/lua/src/ldebug.c
--- redis-5.0.14/deps/lua/src/ldebug.c 2021-10-04 18:58:43.000000000 +0800
+++ redis-5.0.14-new/deps/lua/src/ldebug.c 2022-05-16 11:01:09.877613000 +0800
@@ -80,7 +80,6 @@
return L->basehookcount;
}
-
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
int status;
CallInfo *ci;
diff -Naru redis-5.0.14/deps/lua/src/lobject.h redis-5.0.14-new/deps/lua/src/lobject.h
--- redis-5.0.14/deps/lua/src/lobject.h 2021-10-04 18:58:43.000000000 +0800
+++ redis-5.0.14-new/deps/lua/src/lobject.h 2022-05-16 11:03:06.374928000 +0800
@@ -337,7 +337,8 @@
typedef struct Table {
CommonHeader;
- lu_byte flags; /* 1<<p means tagmethod(p) is not present */
+ lu_byte flags; /* 1<<p means tagmethod(p) is not present */
+ int readonly;
lu_byte lsizenode; /* log2 of size of `node' array */
struct Table *metatable;
TValue *array; /* array part */
diff -Naru redis-5.0.14/deps/lua/src/ltable.c redis-5.0.14-new/deps/lua/src/ltable.c
--- redis-5.0.14/deps/lua/src/ltable.c 2021-10-04 18:58:43.000000000 +0800
+++ redis-5.0.14-new/deps/lua/src/ltable.c 2022-05-16 14:40:02.759382000 +0800
@@ -364,6 +364,7 @@
t->array = NULL;
t->sizearray = 0;
t->lsizenode = 0;
+ t->readonly = 0;
t->node = cast(Node *, dummynode);
setarrayvector(L, t, narray);
setnodevector(L, t, nhash);
diff -Naru redis-5.0.14/deps/lua/src/lua.h redis-5.0.14-new/deps/lua/src/lua.h
--- redis-5.0.14/deps/lua/src/lua.h 2021-10-04 18:58:43.000000000 +0800
+++ redis-5.0.14-new/deps/lua/src/lua.h 2022-05-16 11:06:52.052521000 +0800
@@ -358,6 +358,9 @@
int i_ci; /* active function */
};
+ LUA_API void lua_enablereadonlytable (lua_State *L, int index, int enabled);
+ LUA_API int lua_isreadonlytable (lua_State *L, int index);
+
/* }====================================================================== */
diff -Naru redis-5.0.14/deps/lua/src/lvm.c redis-5.0.14-new/deps/lua/src/lvm.c
--- redis-5.0.14/deps/lua/src/lvm.c 2021-10-04 18:58:43.000000000 +0800
+++ redis-5.0.14-new/deps/lua/src/lvm.c 2022-05-16 11:14:26.356619000 +0800
@@ -138,6 +138,8 @@
const TValue *tm;
if (ttistable(t)) { /* `t' is a table? */
Table *h = hvalue(t);
+ if (h->readonly)
+ luaG_runerror(L, "Attempt to modify a readonly table");
TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
if (!ttisnil(oldval) || /* result is no nil? */
(tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/deng-yuyu-01/redis5.git
git@gitee.com:deng-yuyu-01/redis5.git
deng-yuyu-01
redis5
redis5
master

搜索帮助