From d8ea68d3dd04b8fe50739ffa30a4d39c97cb9b40 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 15 Nov 2023 12:49:01 +0100 Subject: [PATCH] [Core] Fix File.get_buffer returning wrong length File.get_buffer always returned as many bytes as requested (even when EOF was reached), this resulted in random bytes being returned when overflowing. --- core/bind/core_bind.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index c26fa7ef9b1..fac5ced952b 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2177,7 +2177,7 @@ PoolVector _File::get_buffer(int64_t p_length) const { w.release(); if (len < p_length) { - data.resize(p_length); + data.resize(len); } return data;