mirror of
https://github.com/redis/redis.git
synced 2026-02-03 20:39:54 -05:00
Make tests pass
Signed-off-by: Rushabh Mehta <mehtarushabh2005@gmail.com>
This commit is contained in:
parent
cdb04e76c6
commit
6607ca12d0
2 changed files with 18 additions and 17 deletions
|
|
@ -593,7 +593,7 @@ static void luaReplyToRedisReply(client *c, client* script_client, lua_State *lu
|
|||
return;
|
||||
}
|
||||
|
||||
if (level++ == MAX_STACK_DEPTH) {
|
||||
if (++level > MAX_STACK_DEPTH) {
|
||||
/* This case is for preventing server crashes when the C stack limit is reached first */
|
||||
addReplyError(c, "max recursion level reached");
|
||||
lua_pop(lua,1);
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,7 @@ start_server {tags {"scripting"}} {
|
|||
set res [run_script {local a = {}; local b = {a}; a[1] = b; return a} 0]
|
||||
# drain the response
|
||||
while {true} {
|
||||
if {$res == "-ERR reached lua stack limit"} {
|
||||
if {$res == "-ERR max recursion level reached"} {
|
||||
break
|
||||
}
|
||||
assert_equal $res "*1"
|
||||
|
|
@ -1056,25 +1056,26 @@ start_server {tags {"scripting"}} {
|
|||
}
|
||||
}
|
||||
|
||||
if {!$::log_req_res} {
|
||||
test {new test} {
|
||||
r readraw 1
|
||||
set res [run_script {
|
||||
local t = {} for i=1,5000 do t = {t} end return t
|
||||
} 0]
|
||||
|
||||
while {true} {
|
||||
if {$res == "-ERR max recursion level reached"} {
|
||||
break
|
||||
}
|
||||
assert_equal $res "*1"
|
||||
set res [r read]
|
||||
|
||||
test {recursion protection in reply conversion} {
|
||||
r readraw 1
|
||||
run_script {
|
||||
local t = {} for i=1,500 do t = {t} end return t
|
||||
} 0
|
||||
set res [r read]
|
||||
# drain the response
|
||||
while {true} {
|
||||
if {$res == "-ERR max recursion level reached"} {
|
||||
break
|
||||
}
|
||||
r readraw 0
|
||||
assert_equal [r ping] {PONG}
|
||||
assert_equal $res "*1"
|
||||
set res [r read]
|
||||
}
|
||||
r readraw 0
|
||||
assert_equal [r ping] {PONG}
|
||||
}
|
||||
|
||||
|
||||
test {Script check unpack with massive arguments} {
|
||||
run_script {
|
||||
local a = {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue