From c680057dad547ae7e7a5a10b3eb81d6236484f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Fertyk?= Date: Tue, 25 May 2021 17:31:00 +0200 Subject: [PATCH] Return error when decompressing empty buffer (cherry picked from commit f563cabb4ef486d58eede162e4084d94f7cc3895) --- core/variant_call.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/variant_call.cpp b/core/variant_call.cpp index b7296de1c2c..65821c9cb56 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -632,6 +632,10 @@ struct _VariantCall { r_ret = decompressed; ERR_FAIL_MSG("Decompression buffer size must be greater than zero."); } + if (ba->size() == 0) { + r_ret = decompressed; + ERR_FAIL_MSG("Compressed buffer size must be greater than zero."); + } decompressed.resize(buffer_size); int result = Compression::decompress(decompressed.write().ptr(), buffer_size, ba->read().ptr(), ba->size(), mode);