commit f1dd413: [Minor] Do not decompress empty stream as zst behaves badly in this case

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Apr 26 15:49:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-04-26 16:48:20 +0100
URL: https://github.com/rspamd/rspamd/commit/f1dd413d7a092c432e032aac8c3dd46eee332aa1

[Minor] Do not decompress empty stream as zst behaves badly in this case

---
 src/lua/lua_compress.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lua/lua_compress.c b/src/lua/lua_compress.c
index 8d2a7e70b..5bebd0e0d 100644
--- a/src/lua/lua_compress.c
+++ b/src/lua/lua_compress.c
@@ -545,6 +545,10 @@ lua_zstd_decompress_stream (lua_State *L)
 	if (ctx && t) {
 		gsize dlen = 0;
 
+		if (t->len == 0) {
+			return lua_zstd_push_error (L, ZSTD_error_init_missing);
+		}
+
 		inb.size = t->len;
 		inb.pos = 0;
 		inb.src = (const void*)t->start;


More information about the Commits mailing list