summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorranshid <88133677+ranshid@users.noreply.github.com>2023-02-28 12:02:55 +0200
committerGitHub <noreply@github.com>2023-02-28 12:02:55 +0200
commit18017df7c1407bc025741c64a90f20f4a8098bd2 (patch)
tree60242667f7c8e78a467e820b636d61991784f3fd /tests/unit
parent4972760b67e793413ff885d1e05c01627497d360 (diff)
downloadredis-18017df7c1407bc025741c64a90f20f4a8098bd2.tar.gz
Fix possible memory corruption in FLUSHALL when a client watches more than one key (#11854)
Avoid calling unwatchAllKeys when running touchAllWatchedKeysInDb (which was unnecessary) This can potentially lead to use-after-free and memory corruption when the next entry pointer held by the watched keys iterator is freed when unwatching all keys of a specific client. found with address sanitizer, added a test which will not always fail (depending on the random dict hashing seed) problem introduced in #9829 (Reids 7.0) Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/multi.tcl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/multi.tcl b/tests/unit/multi.tcl
index 26ab8e571..bdf398150 100644
--- a/tests/unit/multi.tcl
+++ b/tests/unit/multi.tcl
@@ -894,6 +894,14 @@ start_server {tags {"multi"}} {
r readraw 1
set _ $res
} {*CONFIG SET failed*}
+
+ test "Flushall while watching several keys by one client" {
+ r flushall
+ r mset a a b b
+ r watch b a
+ r flushall
+ r ping
+ }
}
start_server {overrides {appendonly {yes} appendfilename {appendonly.aof} appendfsync always} tags {external:skip}} {