diff options
author | Rayyan Ansari <rayyan@ansari.sh> | 2023-11-05 20:21:16 +0000 |
---|---|---|
committer | Rayyan Ansari <rayyan@ansari.sh> | 2023-11-05 20:21:16 +0000 |
commit | 0e4d0823617240345cc8ac5f3703636d041c2df3 (patch) | |
tree | 1256c653c8f29f26d9214195ca9479ffab00c85e | |
parent | df571078cfafcd0b98f3b84b84e44c97ac8ff7cf (diff) |
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.
-rw-r--r-- | src/frontend/qt_sdl/ROMManager.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp index 6b4ddee..6b2b0b0 100644 --- a/src/frontend/qt_sdl/ROMManager.cpp +++ b/src/frontend/qt_sdl/ROMManager.cpp @@ -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; |