From 26174123eecb4539406b81aff3a6921c6cc6abba Mon Sep 17 00:00:00 2001 From: Binbin Date: Sat, 1 Jul 2023 22:35:35 +0800 Subject: [PATCH] Avoid DEBUG POPULATE crash at dictExpand OOM (#12363) Change to use dictTryExpand, return error on OOM. --- src/debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index a85605e20..a57b1fde9 100644 --- a/src/debug.c +++ b/src/debug.c @@ -713,7 +713,10 @@ NULL if (getPositiveLongFromObjectOrReply(c, c->argv[2], &keys, NULL) != C_OK) return; - dictExpand(c->db->dict,keys); + if (dictTryExpand(c->db->dict, keys) != DICT_OK) { + addReplyError(c, "OOM in dictTryExpand"); + return; + } long valsize = 0; if ( c->argc == 5 && getPositiveLongFromObjectOrReply(c, c->argv[4], &valsize, NULL) != C_OK ) return;