summaryrefslogtreecommitdiff
path: root/core/variant/variant_call.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-05-25 21:17:48 +0200
committerGitHub <noreply@github.com>2021-05-25 21:17:48 +0200
commitb6f381475fed44be21b8dd66cdb86e1a3b3af9cf (patch)
tree90feead6c86a6539d8f63bfb92b04d9595bead3d /core/variant/variant_call.cpp
parent6a64a9803970a625103cbbfe3a6c319a9ede0e21 (diff)
parentee8c9bb614368864e21391f9456f31943b4d3000 (diff)
Merge pull request #49073 from pfertyk/issue-49006-packedbytearray-decompress-crashes-godot
Return error when decompressing empty PackedByteArray
Diffstat (limited to 'core/variant/variant_call.cpp')
-rw-r--r--core/variant/variant_call.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index efaaa8cd19..063611d415 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -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);