From 02cb608d5a6896b3ebfe903e06883d517c3cff14 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:42:56 +0200 Subject: [PATCH] [Core] Fix `FileAccessCompressed.get_buffer` size error on multiples of block size --- core/io/file_access_compressed.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index 0f00bd292cd..ff055f3026d 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -316,6 +316,14 @@ uint64_t FileAccessCompressed::get_buffer(uint8_t *p_dst, uint64_t p_length) con read_block_size = read_block == read_block_count - 1 ? read_total % block_size : block_size; read_pos = 0; + if (read_block_size == 0) { + at_end = true; + if (i + 1 < p_length) { + read_eof = true; + } + return i + 1; + } + } else { read_block--; at_end = true;