mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-08 05:33:28 +02:00
ISOFileSystem: Don't crash when the image has no ISO9660 volume
The constructor leaves treeroot null when it can't find a CD001 volume descriptor, but GetFromPath walked into it anyway - TreeEntry *entry = treeroot; then entry->valid - so any path lookup on a failed mount dereferenced null. Reachable from the firmware installer, which mounts whatever file it's handed and asks for PSP_GAME/SYSDIR/UPDATE without consulting Error() first. Point it at a PlayStation disc image, whose descriptor sits behind a Mode 2 subheader and so fails the signature check, and PPSSPP goes down. Identify_File checks for CD001 before reporting PSP_ISO, so the game browser was never exposed. Return null instead, which is what the rest of the function already does for a path that isn't there, and what every caller expects.
This commit is contained in:
@@ -335,6 +335,11 @@ const ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(std::string_view path
|
||||
if (pathLength <= pathIndex)
|
||||
return treeroot;
|
||||
|
||||
if (!treeroot) {
|
||||
// The constructor gave up - no ISO9660 volume descriptor, or it wouldn't read.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TreeEntry *entry = treeroot;
|
||||
while (true) {
|
||||
if (!entry->valid) {
|
||||
|
||||
Reference in New Issue
Block a user