diff options
author | kleonc <9283098+kleonc@users.noreply.github.com> | 2023-04-07 16:37:20 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-24 17:03:57 +0200 |
commit | 13cfbe6a256ef156c39a70974f01e1388629711f (patch) | |
tree | de1a5be7c7c1b7b07d737dce7a70ded645e7d712 /servers | |
parent | d936cc8b9eb470faa6b9d38982128806321028cc (diff) |
Fix deserializing resource usage debug data
(cherry picked from commit 3e7752463aed5adc59dc0f962e541b691800315f)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/debugger/servers_debugger.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/servers/debugger/servers_debugger.cpp b/servers/debugger/servers_debugger.cpp index 75452be49b..e1bdba0595 100644 --- a/servers/debugger/servers_debugger.cpp +++ b/servers/debugger/servers_debugger.cpp @@ -56,15 +56,17 @@ Array ServersDebugger::ResourceUsage::serialize() { bool ServersDebugger::ResourceUsage::deserialize(const Array &p_arr) { CHECK_SIZE(p_arr, 1, "ResourceUsage"); uint32_t size = p_arr[0]; - CHECK_SIZE(p_arr, size, "ResourceUsage"); - int idx = 1; - for (uint32_t i = 0; i < size / 4; i++) { + ERR_FAIL_COND_V(size % 4, false); + CHECK_SIZE(p_arr, 1 + size, "ResourceUsage"); + uint32_t idx = 1; + while (idx < 1 + size) { ResourceInfo info; info.path = p_arr[idx]; info.format = p_arr[idx + 1]; info.type = p_arr[idx + 2]; info.vram = p_arr[idx + 3]; infos.push_back(info); + idx += 4; } CHECK_END(p_arr, idx, "ResourceUsage"); return true; |