Return error when decompressing empty PoolByteArray

This commit is contained in:
Paweł Fertyk 2021-05-25 18:43:26 +02:00
parent f1abfbbeb1
commit ee8c9bb614
1 changed files with 3 additions and 0 deletions

View File

@ -611,6 +611,9 @@ struct _VariantCall {
if (buffer_size <= 0) {
ERR_FAIL_V_MSG(decompressed, "Decompression buffer size must be greater than zero.");
}
if (p_instance->size() == 0) {
ERR_FAIL_V_MSG(decompressed, "Compressed buffer size must be greater than zero.");
}
decompressed.resize(buffer_size);
int result = Compression::decompress(decompressed.ptrw(), buffer_size, p_instance->ptr(), p_instance->size(), mode);