From 2c41b135052125490a76c0d1cca968f86b10570a Mon Sep 17 00:00:00 2001 From: Binbin Date: Tue, 21 Nov 2023 23:00:27 +0800 Subject: [PATCH] Block DEBUG POPULATE in loading and async-loading (#12790) When we are loading data, it is not safe to generate data through DEBUG POPULATE. POPULATE may generate keys, causing panic when loading data with duplicate keys. --- src/debug.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/debug.c b/src/debug.c index e537126f8da..1d117635947 100644 --- a/src/debug.c +++ b/src/debug.c @@ -716,6 +716,11 @@ NULL if (getPositiveLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != C_OK) return; + if (server.loading || server.async_loading) { + addReplyErrorObject(c, shared.loadingerr); + return; + } + if (dbExpand(c->db, keys, DB_MAIN, 1) == C_ERR) { addReplyError(c, "OOM in dictTryExpand"); return;