summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
AgeCommit message (Collapse)Author
3 daysMerge pull request #14768 from phire/security/gcz_overflowsJosJuice
Better validation and handling of GCZ
6 daysMerge pull request #13543 from tygyh/DiscIO-Use-views-keysScott Mansell
DiscIO: Use views::keys
7 daysGCZ: use 64-bit for m_data_offsetScott Mansell
A malicious GCZ file could probably force this to be negative. Shouldn't cause any issues other than file read failures, but need to fix because it is causing errors on MSVC.
7 daysGCZ: validate while loadingScott Mansell
7 daysGCZ: Don't trust block_num eitherScott Mansell
SectorReader::ReadChunk does do some validation on it, but it only checks against the original disc size (reported by the GCZ file). It has no idea how many blocks the header claimed the disc had. A maliciously crafted GCZ file could trigger read overflows off the end of the m_block_pointers/m_hashes arrays.
7 daysGCZ: Don't trust GetBlockCompressedSizeScott Mansell
It comes unverified from the file, and a maliciously crafted file could trigger not one, but two buffer overflows in the heap.
10 daysDirectoryBlob: Resolve reorder warningJoshua Vandaële
2026-07-15Merge pull request #14732 from khang06/small-tmd-checkAdmiral H. Curtiss
IOS/ES: Prevent reading TMDs that are too small
2026-07-15IOS/ES: Prevent reading TMDs that are too smallKhang
2026-07-14Merge pull request #14705 from JosJuice/directoryblob-dtk-commentDentomologist
DiscIO: Add DTK alignment comment in DirectoryBlob
2026-07-14DiscIO: Add DTK alignment comment in DirectoryBlobJosJuice
This requirement came up in the review of e013d95. Instead of just removing the comment like e013d95 did, let's add a more detailed comment.
2026-07-11Core: Add `Volume::GetSimulatedMemorySize()`.cristian64
The data structure of the `bi2.bin` file in which the simulated memory size is set: > **13.2 Disk header Information** > > this is loaded to the Address in `0x800000f4` when a disc is initialized by the IPL > > | offset | end | size | Description | > | :------: | --- | :--: | --------------------- | > | `0x0000` | | 4 | Debug-monitor Size | > | `0x0004` | | 4 | Simulated Memory Size | > | `0x0008` | | 4 | Argument offset | > | `0x000c` | | 4 | Debug flag | > | `0x0010` | | 4 | Track Location | > | `0x0014` | | 4 | Track size | > | `0x0018` | | 4 | Countrycode | > | `0x001c` | | 4 | ? | See https://hitmen.c02.at/files/yagcd/yagcd/chap13.html#sec13.2. Most GameCube games set the value to `24 MiB`, which matches the physical memory size. Most Wii games set the value to `0 MiB` (unset). The debug build of _Mario Kart: Double Dash!!_ is one game that sets the value to `48 MiB`.
2026-06-28Merge pull request #14599 from naari3/fix/directoryblob-gc-triforce-alignmentJosJuice
DirectoryBlob: fix data alignment for GC/Triforce and skip Triforce DIMM memory range
2026-06-22VolumeVerifier: Remove SystemNotAvailableJosJuice
We had some code in VolumeVerifier to catch the error message that Redump.org used to show when trying to access the Wii datfile without logging in. This restriction was removed from Redump.org around the start of 2022, and the code has been unnecessary ever since.
2026-06-22Don't send Dolphin version in user agent to RedumpJosJuice
When we added the RetroAchievements integration, we had a discussion about whether sending version information in the user agent was fine from a privacy standpoint. We reached the conclusion that it was okay, but it was conditional on the website having a privacy policy. Neither incarnation of Redump has that, and Redump also never asked us to send version information like RetroAchievements did, so let's use a user agent that just says "Dolphin" when connecting to Redump.
2026-06-22Use redump.info instead of redump.orgJosJuice
All the staff of Redump (except the absentee sysadmin) have decided to start a new version of the website at redump.info. It has every disc from the old site, it has HTTPS, it isn't buckling under the load of AI scrapers, and moving forward, all adding and verifying of discs is going to be happening on the new website only. Let's move over. I've taken the unusual step of updating the translation files manually. This is because we're very close to a release and because the change is simple enough that I feel confident about making the change to languages I don't speak. (I double checked that the Korean translation doesn't ever follow "Redump.org" by a particle that has a different form depending on whether there's a final consonant.)
2026-06-04NANDImporter: Abort extraction if a NAND FST entry is visited more than onceAdmiral H. Curtiss
2026-05-30Prevent path traversal in NANDImporter::ProcessEntryJosJuice
Reported by MrSynAckster. A specifically crafted NAND dump could use path traversal to overwrite files on the host file system. This is also an accuracy fix for importing NAND dumps that contain file names that Dolphin is supposed to escape. Some games' save files are affected.
2026-05-30Rework NANDImporter::GetPath slash handlingJosJuice
GetPath has two special cases where it doesn't add a slash. The first is for the root entry's special name "/". The next commit will be neater if we can skip calling GetPath for the root entry, because '/' is one of the characters that Common::EscapeFileName replaces with an escape sequence. Let's check for entry number 0 instead. The second is for parent paths that already end in a slash. There's no actual need to check for this - double slashes are harmless, and for comparison, NANDImporter::ExtractCertificates already appends slashes without checking if there already is one. Let's remove this check.
2026-05-11Merge pull request #14613 from JosJuice/wad-tmd-checksAdmiral H. Curtiss
DiscIO: Add extra IsValid checks for VolumeWAD::m_tmd
2026-04-25DirectoryBlob: fix data alignment for GC/Triforce and skip Triforce DIMM ↵naari3
memory range The 0x8000 alignment in DirectoryBlob is needed for Wii disc group encryption, but for GC/Triforce it inflates file offsets unnecessarily. Use 0x20 alignment for Triforce (matching original disc layout) while keeping 0x8000 for GC due to DTK audio streaming requirements. On Triforce games with many files, the inflated offsets can land in the AMMediaboard DIMM memory range (0x1F000000-0x1F800000). Reads from that region return SRAM data instead of disc data, causing the game to hang. Skip the DIMM range when assigning per-file data offsets if any portion of the file would overlap [0x1F000000, 0x1F800000).
2026-04-20VolumeVerifier: Add extra validity checks for ticket and TMDJosJuice
This fixes VolumeVerifier potentially calling TMDReader::GetIOSId for invalid TMDs. VolumeVerifier also has a call to TMDReader::GetContent that doesn't check if the TMD is valid. In practice, this can't get called with an invalid TMD because the previous commit made it so GetContentOffsets returns an empty vector if the TMD is invalid, but I've added a check inside TMDReader::GetContent just to be on the safe side. I also made VolumeVerifier show a specifically worded problem if the ticket or TMD is invalid. Before, invalid TMDs in Wii discs and WADs and invalid tickets in WADs would show a more generic problem.
2026-04-20DiscIO: Add extra IsValid checks for VolumeWAD::m_tmdJosJuice
Plus an IsValid check inside TMDReader::GetContents, which is called by VolumeWAD. Fixes https://bugs.dolphin-emu.org/issues/14032.
2026-04-20Replace `find(x) != npos` with `contains(x)` - CoreDr. Dystopia
2026-04-17Improve usage of std::move and const references parametersMartino Fontana
Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`. Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move. Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible.
2026-04-11Merge pull request #14500 from Sintendo/span2Jordan Woyak
Replace `const std::vector&` arguments with `std::span`
2026-04-04Improve NAND import progress dialogTillmann Karras
Now with cancel button and an actual progress bar. For simplicity, we do two passes on the progress bar, one for loading the NAND into memory and one for extracting it. The user directory is likely on an SSD, making the extraction pass invisibly fast.
2026-03-23Use more std::span argumentsSintendo
2026-03-15Triforce: Check only first byte in region flag.cristian64
In some Triforce games (e.g. _F-Zero AX_), the bytes that follow the region flag in the `boot.id` file (at `0x38`) happen to be `0x00`. However, in other games (e.g _Mario Kart Arcade GP 2_), it seems the region flag is padded with `0xFF`. _Mario Kart Arcade GP 2_ (`boot.id` in the USA version): ``` 00000 0000: 42 54 49 44 00 00 01 E0 00 00 00 01 00 00 00 01 BTID.... ........ 00000 0010: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ........ ........ 00000 0020: 47 43 41 4D 00 00 01 C0 07 D3 05 0F 00 00 00 07 GCAM.... ........ 00000 0030: 53 42 4E 4C 00 00 00 00 0E FF FF FF FF FF FF FF SBNL.... ........ ----------- ^ | region flag ``` When the region flag was tested in `switch` statements (where a single byte was expected in the `case`s), the test would fail, depending on the game. This issue would lead to the wrong calculation of the country in `VolumeDisc::GetCountry()`, which was then used to build the game ID in `VolumeDisc::GetGameID()`. The solution is to test using only the least meaningful byte in the region flag. Unexpected game IDs were first noticed with USA version of _Mario Kart Arcade GP 2_, which was wrongly assigned the same game ID that is given to the Japan version (i.e. `GNLJ82`). The correct game ID for the USA version is `GNLE82`.
2026-02-24DiscIO: Only allow alphanumeric ASCII in game IDsJosJuice
We often use game IDs in paths, so we should try to make sure path traversal is impossible in game IDs. Admittedly, doing any kind of real attack using the six bytes available in game IDs is unrealistic, but no game ID should contain non-alphanumeric or non-ASCII characters anyway. Might also fix https://bugs.dolphin-emu.org/issues/13982 by skipping converting between encodings for game IDs.
2026-02-24DiscIO: Move DecodeString to Volume.cppJosJuice
This had to be in the header back when it was templated, but 083faa8b made it not templated.
2026-02-15Enums: Unhandled switch statementJoshua Vandaële
2026-02-15DiscIO: Add IsCached virtual function to BlobReader.Jordan Woyak
2026-02-15SI_DeviceAMBaseboard: Add missing bounds checksSepalani
VolumeDisc: Fix Triforce's GetGameID memcpy by checking MakerID's size
2026-02-15Triforce: Code fixes.crediar
Fixed a bug caused by static usage of Core::System::GetInstance() Removed unused headers Removed unneeded code Optimised code Added sanity checks Added SafeCopyFromEmu/SafeCopyToEmu Set Triforce buttons to be translatable
2026-02-15Triforce: Code cleanups.Jordan Woyak
2026-02-15DiscIO: Make Volume::DecodeString take a std::span so it can work with ↵Jordan Woyak
std::array.
2026-02-15Added Triforce supportcrediar
2026-02-06RiivolutionParser: Fix XML Param ParsingGabriela Orzechowska
2026-01-25Remove unused importsMartino Fontana
Yellow squiggly lines begone! Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes. If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed. The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports. Not everything is removed, but the cleanup should be substantial enough. Because this done on Linux, code that isn't used on it is mostly untouched. (Hopefully no open PR is depending on these imports...)
2026-01-24Common/FileSearch: Refactor DoFileSearchSintendo
2026-01-17Merge pull request #14267 from jordan-woyak/std-expectediwubcode
Common: Replace Result with std::expected.
2026-01-17Common: Replace Result with C++23's std::expected.Jordan Woyak
2026-01-17Fix various typos and spelling mistakesSintendo
2026-01-04VolumeFileBlobReader: Define default destructor in source fileDentomologist
Fix an error generated by Clang from the destructor of `std::unique_ptr<FileInfo> m_file_info` when setting the standard version to c++23: `invalid application of 'sizeof' to an incomplete type 'DiscIO::FileInfo'`
2026-01-02DiscIO/Volume: Fix CreateVolume for WiiWare.Jordan Woyak
2025-12-22Merge pull request #14174 from JoshuaVandaele/minizips-cmakeJMC47
Use minizip-ng's CMakeLists instead of relying on our own implementation
2025-12-22Merge pull request #14154 from jordan-woyak/result-parameter-orderJMC47
Common/Result: Swap order of template parameters to match C++26's std::expected.
2025-11-27Use minizip-ng's CMakeLists instead of relying on our own implementationJoshua Vandaële
This is a carry over from back when we used `minizip` and had our own CMakeLists for it.
2025-11-23Core/DiscIO: Add a setting to load the running game into memory via ↵Jordan Woyak
CachedBlobReader.