From f95754186a056001adc26f9654b5fe1b0e19acd3 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 15 Nov 2023 12:49:01 +0100 Subject: [PATCH] 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 69064edb8..9ca0e8e64 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2175,7 +2175,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;