From 2961343a54eac118ab77b4900ab9ff1380abc5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kru=CC=88ss?= Date: Mon, 15 Jun 2026 16:10:06 -0700 Subject: [PATCH] Support negative Zstd compression levels OPT_COMPRESSION_LEVEL treated any value below 1 as "use the default", so negative Zstd levels (e.g. -5) were silently replaced with the default level 3. Zstd supports negative ("fast") compression levels, so only 0 (the ecalloc default and Zstd's own "use default" sentinel) should now map to the default; negative values are passed through to ZSTD_compress, which clamps extreme values to ZSTD_minCLevel() internally. Co-Authored-By: Claude Opus 4.8 (1M context) --- library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.c b/library.c index 362090e06b..2bd0ab982e 100644 --- a/library.c +++ b/library.c @@ -4047,7 +4047,7 @@ redis_compress(RedisSock *redis_sock, char **dst, size_t *dstlen, char *buf, siz size_t size; int level; - if (redis_sock->compression_level < 1) { + if (redis_sock->compression_level == 0) { #ifdef ZSTD_CLEVEL_DEFAULT level = ZSTD_CLEVEL_DEFAULT; #else