From c213f7d7a309a0aa39cd62944f2b3e6b68242672 Mon Sep 17 00:00:00 2001 From: gibbed Date: Wed, 17 Jul 2019 17:53:59 -0500 Subject: [PATCH] [CPU] Properly clear LZX window. --- src/xenia/cpu/lzx.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xenia/cpu/lzx.cc b/src/xenia/cpu/lzx.cc index 992daca43..d9ebe9978 100644 --- a/src/xenia/cpu/lzx.cc +++ b/src/xenia/cpu/lzx.cc @@ -110,9 +110,11 @@ int lzx_decompress(const void* lzx_data, size_t lzx_len, void* dest, if (lzxd) { if (window_data) { // zero the window and then copy window_data to the end of it - std::memset(lzxd->window, 0, window_data_len); - std::memcpy(lzxd->window + (window_size - window_data_len), window_data, - window_data_len); + auto padding_len = window_size - window_data_len; + std::memset(&lzxd->window[0], 0, padding_len); + std::memcpy(&lzxd->window[padding_len], window_data, window_data_len); + // TODO(gibbed): should this be set regardless if source window data is + // available or not? lzxd->ref_data_size = window_size; }