Return error when decompressing empty buffer

(cherry picked from commit f563cabb4e)
This commit is contained in:
Paweł Fertyk 2021-05-25 17:31:00 +02:00 committed by Rémi Verschelde
parent da2f17ae19
commit c680057dad
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -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);