valkey/tests
Meir Shpilraien (Spielrein) a511af7c5e Clean Lua stack before parsing call reply to avoid crash on a call with many arguments (#9809)
This commit 0f8b634cd (CVE-2021-32626 released in 6.2.6, 6.0.16, 5.0.14)
fixes an invalid memory write issue by using `lua_checkstack` API to make
sure the Lua stack is not overflow. This fix was added on 3 places:
1. `luaReplyToRedisReply`
2. `ldbRedis`
3. `redisProtocolToLuaType`

On the first 2 functions, `lua_checkstack` is handled gracefully while the
last is handled with an assert and a statement that this situation can
not happened (only with misbehave module):

> the Redis reply might be deep enough to explode the LUA stack (notice
that currently there is no such command in Redis that returns such a nested
reply, but modules might do it)

The issue that was discovered is that user arguments is also considered part
of the stack, and so the following script (for example) make the assertion reachable:
```
local a = {}
for i=1,7999 do
    a[i] = 1
end
return redis.call("lpush", "l", unpack(a))
```

This is a regression because such a script would have worked before and now
its crashing Redis. The solution is to clear the function arguments from the Lua
stack which makes the original assumption true and the assertion unreachable.

(cherry picked from commit 6b0b04f1b2)
2023-01-17 14:59:41 +02:00
..
assets Tests: Add aclfile load and save tests (#7765) 2020-09-10 14:09:00 +03:00
cluster fix race in cluster transactions test (#8312) 2021-01-12 16:25:37 +02:00
helpers revert an accidental test code change done as part of the tls project 2019-12-01 16:10:09 +02:00
integration add check good slaves to write when execute script (#10249) 2023-01-17 14:59:41 +02:00
modules RM_ZsetRem: Delete key if empty (#8453) 2021-02-23 01:35:37 +02:00
sentinel Recalculate hardcoded variables from $::instances_count in sentinel tests (#7561) 2020-10-27 09:12:01 +02:00
support Fix ziplist and listpack overflows and truncations (CVE-2021-32627, CVE-2021-32628) 2021-10-04 13:59:19 +03:00
tmp
unit Clean Lua stack before parsing call reply to avoid crash on a call with many arguments (#9809) 2023-01-17 14:59:41 +02:00
instances.tcl Allow blocked XREAD on a cluster replica (#7881) 2020-10-27 09:12:01 +02:00
test_helper.tcl Add a --no-latency tests flag. (#7939) 2020-10-27 09:12:01 +02:00