Merge pull request #1895 from lioncash/uninit

patch_manager: Prevent use of a dangling pointer within PatchRomFS
This commit is contained in:
bunnei 2018-12-11 20:27:37 -05:00 committed by GitHub
commit 785d6f9ce0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,13 +286,12 @@ static void ApplyLayeredFS(VirtualFile& romfs, u64 title_id, ContentRecordType t
VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type, VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, ContentRecordType type,
VirtualFile update_raw) const { VirtualFile update_raw) const {
const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}", const auto log_string = fmt::format("Patching RomFS for title_id={:016X}, type={:02X}",
title_id, static_cast<u8>(type)) title_id, static_cast<u8>(type));
.c_str();
if (type == ContentRecordType::Program || type == ContentRecordType::Data) if (type == ContentRecordType::Program || type == ContentRecordType::Data)
LOG_INFO(Loader, log_string); LOG_INFO(Loader, "{}", log_string);
else else
LOG_DEBUG(Loader, log_string); LOG_DEBUG(Loader, "{}", log_string);
if (romfs == nullptr) if (romfs == nullptr)
return romfs; return romfs;