summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2021-10-04 13:35:10 -0700
committermichael-grunder <michael.grunder@gmail.com>2021-10-04 13:35:10 -0700
commita39824a5dfc844ba04a64bf3c90d9d49f64ae3f7 (patch)
tree22f9163d161cf9850160058b86ab8fee8c8971a2 /test.c
parent9eca1f36f4884f5fae8553aef3a0033c13700096 (diff)
parent8d1bfac4640fe90cd6f800d09b7f53e886569b98 (diff)
Merge branch 'release/v1.0.1'
Merge the v1.0.1 release branch and bump the dev version to 1.0.2-dev
Diffstat (limited to 'test.c')
-rw-r--r--test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test.c b/test.c
index f830695..9c91107 100644
--- a/test.c
+++ b/test.c
@@ -499,6 +499,20 @@ static void test_reply_reader(void) {
freeReplyObject(reply);
redisReaderFree(reader);
+ test("Multi-bulk never overflows regardless of maxelements: ");
+ size_t bad_mbulk_len = (SIZE_MAX / sizeof(void *)) + 3;
+ char bad_mbulk_reply[100];
+ snprintf(bad_mbulk_reply, sizeof(bad_mbulk_reply), "*%llu\r\n+asdf\r\n",
+ (unsigned long long) bad_mbulk_len);
+
+ reader = redisReaderCreate();
+ reader->maxelements = 0; /* Don't rely on default limit */
+ redisReaderFeed(reader, bad_mbulk_reply, strlen(bad_mbulk_reply));
+ ret = redisReaderGetReply(reader,&reply);
+ test_cond(ret == REDIS_ERR && strcasecmp(reader->errstr, "Out of memory") == 0);
+ freeReplyObject(reply);
+ redisReaderFree(reader);
+
#if LLONG_MAX > SIZE_MAX
test("Set error when array > SIZE_MAX: ");
reader = redisReaderCreate();