Merge pull request #49072 from pfertyk/issue-49006-decompress-crashes-godot

[3.x] Return error when decompressing empty PoolByteArray
This commit is contained in:
Rémi Verschelde 2021-05-25 21:18:30 +02:00 committed by GitHub
commit 2555567e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -631,6 +631,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);