From 4d8510f9b9c7b4762504f16d3d216948842600c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20T=2E=20Listwon?= Date: Tue, 4 Apr 2023 09:54:33 +0200 Subject: [PATCH] Fix moving position indicator out of bounds in FileAccessMemory (cherry picked from commit bff0c71e2e2cb9b880181cc819c4753abfe59508) --- core/io/file_access_memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/io/file_access_memory.cpp b/core/io/file_access_memory.cpp index 25c3b8ba69c..6e4da42bd52 100644 --- a/core/io/file_access_memory.cpp +++ b/core/io/file_access_memory.cpp @@ -148,7 +148,7 @@ uint64_t FileAccessMemory::get_buffer(uint8_t *p_dst, uint64_t p_length) const { } memcpy(p_dst, &data[pos], read); - pos += p_length; + pos += read; return read; } @@ -176,7 +176,7 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src, uint64_t p_length) { } memcpy(&data[pos], p_src, write); - pos += p_length; + pos += write; } FileAccessMemory::FileAccessMemory() {