From 1abbc3d475f8487de0c24b5665440656d1b55e8c Mon Sep 17 00:00:00 2001 From: Zephyron Date: Wed, 11 Jun 2025 18:47:25 +1000 Subject: [PATCH] fix: prevent crash when detecting newer updates in NCA integrity verification - Change storage assignment from SetDataStorage() method to direct array indexing to prevent crashes when newer game updates are detected. - The previous method was incorrectly handling storage info assignment for integrity verification layers. Signed-off-by: Zephyron --- .../file_sys/fssystem/fssystem_nca_file_system_driver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/fssystem/fssystem_nca_file_system_driver.cpp b/src/core/file_sys/fssystem/fssystem_nca_file_system_driver.cpp index 0d2d607aa..1324577bf 100644 --- a/src/core/file_sys/fssystem/fssystem_nca_file_system_driver.cpp +++ b/src/core/file_sys/fssystem/fssystem_nca_file_system_driver.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "core/file_sys/fssystem/fssystem_aes_ctr_counter_extended_storage.h" @@ -1251,8 +1252,8 @@ Result NcaFileSystemDriver::CreateIntegrityVerificationStorageImpl( R_UNLESS(last_layer_info_offset + layer_info.size <= layer_info_offset, ResultRomNcaInvalidIntegrityLayerInfoOffset); } - storage_info.SetDataStorage(std::make_shared( - std::move(base_storage), layer_info.size, last_layer_info_offset)); + storage_info[level_hash_info.max_layers - 1] = std::make_shared( + std::move(base_storage), layer_info.size, last_layer_info_offset); // Make the integrity romfs storage. auto integrity_storage = std::make_shared();