Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit size of loaded file systems #2610

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions Source/Core/DiscIO/FileSystemGCWii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,18 @@ void CFileSystemGCWii::InitFileSystem()
if (!Root.IsDirectory())
return;

// 12 bytes (the size of a file entry) times 10 * 1024 * 1024 is 120 MiB,
// more than total RAM in a Wii. No file system should use anywhere near that much.
static const u32 ARBITRARY_FILE_SYSTEM_SIZE_LIMIT = 10 * 1024 * 1024;
if (Root.m_FileSize > ARBITRARY_FILE_SYSTEM_SIZE_LIMIT)

This comment was marked as off-topic.

This comment was marked as off-topic.

{
// Without this check, Dolphin can crash by trying to allocate too much
// memory when loading the file systems of certain malformed disc images.

ERROR_LOG(DISCIO, "File system is abnormally large! Aborting loading");
return;
}

if (m_FileInfoVector.size())
PanicAlert("Wtf?");
u64 NameTableOffset = FSTOffset;
Expand Down