summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-11-17 16:24:23 +0100
committerantirez <antirez@gmail.com>2015-11-17 16:24:27 +0100
commit1f35f2dd5ace63862ecd819c4d28f8d844720df1 (patch)
treed4aed5ebe03a2d3cd73547997b82ce10b10b1193
parent6604e04260b1b6b17afcec9e54d20cda041751b1 (diff)
downloadredis-1f35f2dd5ace63862ecd819c4d28f8d844720df1.tar.gz
Lua debugger: fix trace command infinite loop.
Thanks to Itamar Haber for bug report and test case to reproduce.
-rw-r--r--src/scripting.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/scripting.c b/src/scripting.c
index 17ad1c481..63b78f4ca 100644
--- a/src/scripting.c
+++ b/src/scripting.c
@@ -2172,11 +2172,12 @@ void ldbTrace(lua_State *lua) {
while(lua_getstack(lua,level,&ar)) {
lua_getinfo(lua,"Snl",&ar);
- if(strstr(ar.short_src,"user_script") == NULL) continue;
- ldbLog(sdscatprintf(sdsempty(),"%s %s:",
- (level == 0) ? "In" : "From",
- ar.name ? ar.name : "top level"));
- ldbLogSourceLine(ar.currentline);
+ if(strstr(ar.short_src,"user_script") != NULL) {
+ ldbLog(sdscatprintf(sdsempty(),"%s %s:",
+ (level == 0) ? "In" : "From",
+ ar.name ? ar.name : "top level"));
+ ldbLogSourceLine(ar.currentline);
+ }
level++;
}
if (level == 0) {