Compare commits

...
3 Commits
Author SHA1 Message Date
Oran Agra 888effe4be Redis 7.0.4
CI / test-ubuntu-latest (push) Has been cancelled
CI / test-sanitizer-address (push) Has been cancelled
CI / build-debian-old (push) Has been cancelled
CI / build-macos-latest (push) Has been cancelled
CI / build-32bit (push) Has been cancelled
CI / build-libc-malloc (push) Has been cancelled
CI / build-centos7-jemalloc (push) Has been cancelled
External Server Tests / test-external-standalone (push) Has been cancelled
External Server Tests / test-external-cluster (push) Has been cancelled
External Server Tests / test-external-nodebug (push) Has been cancelled
Spellcheck / Spellcheck (push) Has been cancelled
2022-07-18 16:04:07 +03:00
Oran Agra 15ae4e29e5 Fix heap overflow corruption in XAUTOCLAIM (CVE-2022-31144) (#11002)
The temporary array for deleted entries reply of XAUTOCLAIM was
insufficient, but also in fact the COUNT argument should be used to
control the size of the reply, so instead of terminating the loop by
only counting the claimed entries, we'll count deleted entries as well.

Fix #10968
Addresses CVE-2022-31144

(cherry picked from commit 2825b6057b)
2022-07-18 16:04:07 +03:00
Valentino Geron 21fd252a62 remove boolean usage and use 0/1 instead (#10997)
If we do not use jemalloc (mostly with valgrind) and use an old compiler that does not support C11
we will get compilation error

Co-authored-by: Valentino Geron <valentino@redis.com>
(cherry picked from commit 82b8203555)
2022-07-18 16:04:07 +03:00
5 changed files with 35 additions and 6 deletions
+11
View File
@@ -12,6 +12,17 @@ SECURITY: There are security fixes in the release.
--------------------------------------------------------------------------------
================================================================================
Redis 7.0.4 Released Monday Jul 18 12:00:00 IST 2022
================================================================================
Upgrade urgency: SECURITY, contains fixes to security issues.
Security Fixes:
* (CVE-2022-31144) A specially crafted XAUTOCLAIM command on a stream
key in a specific state may result with heap overflow, and potentially
remote code execution. The problem affects Redis versions 7.0.0 or newer.
================================================================================
Redis 7.0.3 Released Monday Jul 11 12:00:00 IST 2022
================================================================================
+2 -2
View File
@@ -334,7 +334,7 @@ static void redisProtocolToLuaType_Error(void *ctx, const char *str, size_t len,
/* push a field indicate to ignore updating the stats on this error
* because it was already updated when executing the command. */
lua_pushstring(lua,"ignore_error_stats_update");
lua_pushboolean(lua, true);
lua_pushboolean(lua, 1);
lua_settable(lua,-3);
}
@@ -891,7 +891,7 @@ static int luaRedisGenericCommand(lua_State *lua, int raise_error) {
/* push a field indicate to ignore updating the stats on this error
* because it was already updated when executing the command. */
lua_pushstring(lua,"ignore_error_stats_update");
lua_pushboolean(lua, true);
lua_pushboolean(lua, 1);
lua_settable(lua,-3);
goto cleanup;
}
+1
View File
@@ -3421,6 +3421,7 @@ void xautoclaimCommand(client *c) {
/* Remember the ID for later */
deleted_ids[deleted_id_num++] = id;
raxSeek(&ri,">=",ri.key,ri.key_len);
count--; /* Count is a limit of the command response size. */
continue;
}
+2 -2
View File
@@ -1,2 +1,2 @@
#define REDIS_VERSION "7.0.3"
#define REDIS_VERSION_NUM 0x00070003
#define REDIS_VERSION "7.0.4"
#define REDIS_VERSION_NUM 0x00070004
+19 -2
View File
@@ -584,9 +584,9 @@ start_server {
# from the PEL of consumer 1, this should return nil
r XDEL mystream $id2
# id1 and id3 are self-claimed here but not id2 ('count' was set to 2)
# id1 and id3 are self-claimed here but not id2 ('count' was set to 3)
# we make sure id2 is indeed skipped (the cursor points to id4)
set reply [r XAUTOCLAIM mystream mygroup consumer2 10 - COUNT 2]
set reply [r XAUTOCLAIM mystream mygroup consumer2 10 - COUNT 3]
assert_equal [llength $reply] 3
assert_equal [lindex $reply 0] $id4
@@ -595,6 +595,8 @@ start_server {
assert_equal [llength [lindex $reply 1 0 1]] 2
assert_equal [lindex $reply 1 0 1] {a 1}
assert_equal [lindex $reply 1 1 1] {c 3}
assert_equal [llength [lindex $reply 2]] 1
assert_equal [llength [lindex $reply 2 0]] 1
# Delete item 3 from the stream. Now consumer 1 has PEL that is empty.
# Try to use consumer 2 to claim the deleted item 3 from the PEL
@@ -701,6 +703,21 @@ start_server {
assert_equal [r XPENDING x grp - + 10 Alice] {}
}
test {XAUTOCLAIM with XDEL and count} {
r DEL x
r XADD x 1-0 f v
r XADD x 2-0 f v
r XADD x 3-0 f v
r XGROUP CREATE x grp 0
assert_equal [r XREADGROUP GROUP grp Alice STREAMS x >] {{x {{1-0 {f v}} {2-0 {f v}} {3-0 {f v}}}}}
r XDEL x 1-0
r XDEL x 2-0
assert_equal [r XAUTOCLAIM x grp Bob 0 0-0 COUNT 1] {2-0 {} 1-0}
assert_equal [r XAUTOCLAIM x grp Bob 0 2-0 COUNT 1] {3-0 {} 2-0}
assert_equal [r XAUTOCLAIM x grp Bob 0 3-0 COUNT 1] {0-0 {{3-0 {f v}}} {}}
assert_equal [r XPENDING x grp - + 10 Alice] {}
}
test {XCLAIM with trimming} {
r DEL x
r config set stream-node-max-entries 2