redict/tests/unit
Meir Shpilraien (Spielrein) 0f8b634cd5
Fix invalid memory write on lua stack overflow (CVE-2021-32626) (#9591)
When LUA call our C code, by default, the LUA stack has room for 10
elements. In most cases, this is more than enough but sometimes it's not
and the caller must verify the LUA stack size before he pushes elements.

On 3 places in the code, there was no verification of the LUA stack size.
On specific inputs this missing verification could have lead to invalid
memory write:
1. On 'luaReplyToRedisReply', one might return a nested reply that will
   explode the LUA stack.
2. On 'redisProtocolToLuaType', 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)
3. On 'ldbRedis', one might give a command with enough arguments to
   explode the LUA stack (all the arguments will be pushed to the LUA
   stack)

This commit is solving all those 3 issues by calling 'lua_checkstack' and
verify that there is enough room in the LUA stack to push elements. In
case 'lua_checkstack' returns an error (there is not enough room in the
LUA stack and it's not possible to increase the stack), we will do the
following:
1. On 'luaReplyToRedisReply', we will return an error to the user.
2. On 'redisProtocolToLuaType' we will exit with panic (we assume this
   scenario is rare because it can only happen with a module).
3. On 'ldbRedis', we return an error.
2021-10-04 15:17:50 +03:00
..
moduleapi Modules: add RM_LoadDataTypeFromStringEncver (#9537) 2021-09-30 11:21:32 +03:00
type decrby LLONG_MIN caused nagation overflow. (#9577) 2021-10-03 09:38:05 +03:00
acl.tcl Remove redundant validation and prevent duplicate users during ACL load (#9330) 2021-09-09 07:40:33 -07:00
aofrw.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
auth.tcl Prevent unauthenticated client from easily consuming lots of memory (CVE-2021-32675) (#9588) 2021-10-04 12:10:31 +03:00
bitfield.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
bitops.tcl bitpos/bitcount add bit index (#9324) 2021-09-12 11:31:22 +03:00
client-eviction.tcl Client eviction ci issues (#9549) 2021-09-26 17:45:02 +03:00
dump.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
expire.tcl Add NX/XX/GT/LT options to EXPIRE command group (#2795) 2021-08-02 08:57:49 +03:00
geo.tcl GEO* STORE with empty src key delete the dest key and return 0, not empty array (#9271) 2021-08-01 19:32:24 +03:00
hyperloglog.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
info.tcl [BUGFIX] Add some missed error statistics (#9328) 2021-08-06 19:27:24 -07:00
introspection-2.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
introspection.tcl Let CONFIG GET * show both replicaof and its alias (#9395) 2021-08-21 19:43:18 -07:00
keyspace.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
latency-monitor.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
lazyfree.tcl tune lazyfree test timeout (#9527) 2021-09-22 09:48:44 +03:00
limits.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
maxmemory.tcl verbose debug print in test to debug rare CI failure. (#9563) 2021-09-29 17:10:05 +03:00
memefficiency.tcl Tune timeout of active defrag test (#9426) 2021-08-30 12:39:09 +03:00
multi.tcl Fail EXEC command in case a watched key is expired (#9194) 2021-07-11 13:17:23 +03:00
networking.tcl Pre-test bind-source-addr before running test. (#9214) 2021-07-11 09:54:07 +03:00
obuf-limits.tcl Better error handling for updateClientOutputBufferLimit. (#9308) 2021-08-29 15:03:05 +03:00
oom-score-adj.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
other.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
pause.tcl Fix wrong offset when replica pause (#9448) 2021-09-08 16:07:25 +08:00
pendingquerybuf.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
printver.tcl Print version info before running the test 2011-05-20 11:44:54 +02:00
protocol.tcl Remove argument count limit, dynamically grow argv. (#9528) 2021-10-03 09:13:09 +03:00
pubsub.tcl Add test verifying PUBSUB NUMPAT behavior (#9209) 2021-09-03 15:52:39 -07:00
querybuf.tcl Ignore resize threshold on idle qbuf resizing (#9322) 2021-08-06 20:50:34 +03:00
quit.tcl Add tests for OK on QUIT 2010-10-15 12:54:53 +02:00
scan.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
scripting.tcl Fix invalid memory write on lua stack overflow (CVE-2021-32626) (#9591) 2021-10-04 15:17:50 +03:00
shutdown.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
slowlog.tcl slowlog get command supports passing in -1 to get all logs. (#9018) 2021-06-14 16:46:45 +03:00
sort.tcl Add SORT_RO command (#9299) 2021-08-09 09:40:29 +03:00
tls.tcl Add support for reading encrypted keyfiles. (#8644) 2021-03-22 13:27:46 +02:00
tracking.tcl Fix race in client side tracking (#9116) 2021-06-22 07:35:59 +03:00
violations.tcl Fix ziplist and listpack overflows and truncations (CVE-2021-32627, CVE-2021-32628) (#9589) 2021-10-04 12:11:02 +03:00
wait.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00