]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Do not decompress empty stream as zst behaves badly in this case
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Apr 2021 15:48:20 +0000 (16:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 26 Apr 2021 15:48:20 +0000 (16:48 +0100)
src/lua/lua_compress.c

index 8d2a7e70b095ae38335bb674315fb4ee51ef5b32..5bebd0e0d95845674b102d0b364cec338f441592 100644 (file)
@@ -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;