From 2a05fa0d481d12d3747465c4f14470bdca100c5d Mon Sep 17 00:00:00 2001 From: hwware Date: Mon, 8 Jun 2020 23:36:01 -0400 Subject: [PATCH] fix server crash in STRALGO command --- src/t_string.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/t_string.c b/src/t_string.c index 5306069bf..d1a3e1b96 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -534,6 +534,13 @@ void stralgoLCS(client *c) { } obja = lookupKeyRead(c->db,c->argv[j+1]); objb = lookupKeyRead(c->db,c->argv[j+2]); + + if ( !(obja->type == OBJ_STRING) || !(objb->type == OBJ_STRING) ) { + addReplyError(c,"Object associate with KEYS option should only be string type"); + return; + + } + obja = obja ? getDecodedObject(obja) : createStringObject("",0); objb = objb ? getDecodedObject(objb) : createStringObject("",0); a = obja->ptr;