From d26bebc685472e3d5d6ad4e8941fe6b097b7cbf3 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 9 Jan 2013 01:13:38 -0800 Subject: [PATCH] Return an error if the raw lbn is too high. --- Core/FileSystems/ISOFileSystem.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index 8796c74bc5..2a2403cff5 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -337,6 +337,12 @@ u32 ISOFileSystem::OpenFile(std::string filename, FileAccess access) { u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF; parseLBN(filename, §orStart, &readSize); + if (sectorStart >= blockDevice->GetNumBlocks()) + { + WARN_LOG(FILESYS, "Unable to open raw sector: %s, sector %08x, max %08x", filename.c_str(), sectorStart, blockDevice->GetNumBlocks()); + return 0; + } + INFO_LOG(FILESYS, "Got a raw sector open: %s, sector %08x, size %08x", filename.c_str(), sectorStart, readSize); u32 newHandle = hAlloc->GetNewHandle(); entry.seekPos = 0;