mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-06-28 09:59:41 -06:00
ROMManager: initialise filedata to nullptr
If a user manages to open a file as a ROM that is greater than 1 GiB, it will cause a segmentation fault (a crash) in LoadROM due to a delete being called on an uninitialised pointer, which is undefined behaviour. Initialise filedata to nullptr to prevent this, as deleting a null pointer is defined as a no-op.
This commit is contained in:
@ -1109,7 +1109,7 @@ bool LoadROM(QStringList filepath, bool reset)
|
||||
{
|
||||
if (filepath.empty()) return false;
|
||||
|
||||
u8* filedata;
|
||||
u8* filedata = nullptr;
|
||||
u32 filelen;
|
||||
|
||||
std::string basepath;
|
||||
|
Reference in New Issue
Block a user