Skip to content

Commit

Permalink
Block DEBUG POPULATE in loading and async-loading
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
enjoy-binbin committed Nov 21, 2023
1 parent 4278ed8 commit 80b90d5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 80b90d5

Please sign in to comment.