Commit Graph
133 Commits
Author SHA1 Message Date
Henrik Rydgård 725cd691b3 Limit total extracted size when installing zips (zip bomb protection)
ExtractZipContents wrote every entry's declared size with no ceiling, so
a small high-ratio zip could decompress to fill the storage device.

- Add a maxTotalSize parameter to ExtractZipContents (default 4GB) and
  ExtractFile.
- Bail out in the size-summation pass when the total declared size
  exceeds the limit, and again per write chunk in case declared sizes
  are inaccurate.
2026-08-01 13:16:21 +02:00
Henrik Rydgård f3d7d8bc0c Fix Zip Slip in zip extraction and add unit test
A crafted zip with a parent-directory ("..") entry name could escape the
destination directory during extraction, writing arbitrary files on the
host (e.g. into startup/autostart folders). ExtractZipContents built the
output path by concatenating the raw zip entry name onto the destination
with no traversal check.

Changes:
- Add HasParentDirComponent() utility in Core/Util/PathUtil and use it in
  GameManager::ExtractZipContents to reject entries with a ".." component.
  Guard both the directory-creation and file-writing passes.
- Expose ExtractZipContents as public for testing.
- Add unittest/TestZipSlip which crafts a zip with a "../evil.txt" entry
  and verifies it is not written outside the destination directory.
2026-07-31 20:35:12 +02:00
Henrik Rydgård bfe6debcfd Support auto-installing plugins from ZIPs with a deeper directory structure 2026-04-14 11:55:13 -06:00
Henrik Rydgård 288b72cb16 Add 7z streaming support, so we can have a progress bar 2026-03-27 14:34:18 -06:00
Henrik Rydgård 5e0a9a0113 Add really simple 7z extraction, using the 7z VFS 2026-03-27 14:34:18 -06:00
Henrik Rydgård 0e55129fab Prepare for dumping NPDRM isos, use shared_ptr to manage lifetime of BlockDevice 2026-03-19 13:59:04 +01:00
Henrik Rydgård e8d648e91d InstallZip: Fix problem where the delete-after option didn't work
The file was held open.
2026-03-06 10:57:22 +01:00
Henrik Rydgård c74e21243d Add support for installing plugins directly from zip files 2026-02-25 14:28:57 +01:00
Henrik Rydgård 0f85b06908 Add basic support for installing savestate ZIPs (useful for iOS testing) 2026-01-29 22:10:46 +01:00
刘皓 51e3eb69af Remove all calls to zip_close() from Core/Util/GameManager.cpp
The zip file will be closed automatically when the `ZipContainer` goes
out of scope, or when `.close()` is called on the `ZipContainer`.
2026-01-08 11:49:05 -05:00
Henrik Rydgård 77f9a27c35 Add a way for errors to bubble up out of BlockDevice creation 2025-06-07 12:30:20 +02:00
Henrik Rydgård 71533ac2b7 Trash handling is too high level for FileUtil, move it up. 2025-04-15 17:42:24 +02:00
Henrik Rydgård 70c341ab35 Buildfix 2025-04-13 01:12:38 +02:00
Henrik Rydgård 1babbca72a Move the zip file content checker into Loaders.cpp, should fix the libretro build 2025-04-12 23:38:59 +02:00
Henrik Rydgård fffbed53bc Add a ZipFileLoader, which can let us load any single-file file type from a zip.
Useful for loading framedumps from github without manually having to
unzip each one, for example.
2025-04-12 22:23:23 +02:00
Henrik Rydgård 605daf879b Minor cleanup. Fix file handle leak when opening zip files from the main screen. 2025-04-07 15:42:51 +02:00
Henrik Rydgård a50b303a38 Redesign the recent files API a bit. 2025-03-26 17:59:30 +01:00
Henrik Rydgård eb719c43e8 HTTP: Replace ProgressBarMode with a new RequestFlags enum 2025-01-23 12:09:56 +01:00
Henrik Rydgård 12adad0494 HTTP request classes code cleanup - move common things up to the base class 2025-01-23 10:16:51 +01:00
Henrik Rydgård 9e564e3675 Add a null check in zip file parsing 2024-10-10 16:01:00 +02:00
Henrik Rydgård c49f7b9207 Sneak in a couple little fixes for savedata zip install 2024-09-10 19:08:01 +02:00
Henrik Rydgård 10d3b253a4 More InstallZip refactoring, add options for install directory where applicable 2024-09-10 13:55:12 +02:00
Henrik Rydgård 59b39a190c Merge pull request #19436 from hrydgard/save-data-install
Implement save data install from ZIP
2024-09-07 16:59:04 +02:00
Henrik Rydgård 48a0c0f068 Fix using ESC in savedata screen. Warning fix 2024-09-07 16:00:52 +02:00
Henrik Rydgård ce4f8ba6f4 Buildfix 2024-09-07 15:58:15 +02:00
Henrik Rydgård 8186f14a57 Much more UI work on savedata import
fix
2024-09-07 15:28:57 +02:00
Henrik Rydgård f38cc4a959 Add some prototype UI for overwriting saves 2024-09-05 20:52:12 +02:00
Henrik Rydgård 3a047369fd Add ability to install savedata from GameFAQs-style ZIP files 2024-09-05 17:12:10 +02:00
Eric Warmenhoven 59444a71f8 build fix on macosx pre-10.14 2024-09-04 16:45:37 -04:00
Henrik Rydgård db550fc433 More refactoring of installzip code 2024-09-04 17:08:26 +02:00
Henrik Rydgård 795c4c4262 Zip install: Minor refactoring, putting the content identifier in ZipFileInfo. 2024-09-04 12:53:45 +02:00
Henrik Rydgård bdd11af620 Fix some bugs in zip file extraction, refresh game list after 2024-08-06 09:25:44 -06:00
Henrik Rydgård 1eb1a69096 Zip Installation: Show the failed filename in the message 2024-07-20 00:14:23 +02:00
Henrik Rydgård e01ca5b057 Logging API change (refactor) (#19324)
* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
2024-07-14 14:42:59 +02:00
Herman Semenov c20cb3f4be Minor optimize methods std::string using param as char with simpler implementation 2024-04-10 17:57:05 +03:00
Henrik Rydgård 55974f61ad Fix a bunch of cases where we forgot to check for chd files 2024-03-13 09:31:31 +01:00
Henrik Rydgård c5791764d8 Make the i18n T function use std::string_view
Buildfixes, crashfixes

One more

Android buildfix

Buildfix Qt
2024-02-12 18:44:39 +01:00
Henrik Rydgård 6ce4933db8 Split the discard-stencil-bug flag into separate flags for Adreno and Mali 2024-02-02 11:11:31 +01:00
Henrik Rydgård c6c0d0bf42 Android memstick folder moves: Do recursive moves if in the same device. Drastically faster. 2024-01-22 16:26:29 +01:00
Henrik Rydgård c2850ff65a Store: Implement progress bar for homebrew installs 2024-01-22 11:55:42 +01:00
Henrik Rydgård bd388fc094 Add some comments and logging 2024-01-22 11:55:42 +01:00
Henrik Rydgård 7fafc0d83b Improve error handling in homebrew install slightly 2023-12-20 18:28:41 +01:00
Herman Semenov af41281761 [Core/Dialog/ELF/FileSystems/HLE/HW/Util] Added const reference for function params 2023-12-14 14:22:24 +03:00
Henrik Rydgård d234fa24e6 Add progress bar (without %) to install/uninstall. Other fixes. 2023-12-08 16:16:28 +01:00
Henrik Rydgård 888b32e243 Store: Perform uninstalls on a background thread, to avoid hanging the UI 2023-12-08 16:16:26 +01:00
Henrik Rydgård a929eb6c6d Store: Remove unnecessary std::shared_ptr around the install thread 2023-12-08 12:49:15 +01:00
Henrik Rydgård ecea3844b0 Improved progress bar popups for downloads
Now shows the filename, and also there's a delay mode where they'll only
be visible if the download takes more than a second, plus they can be
named.
2023-07-18 15:13:44 +02:00
Unknown W. Brackets 252d71f27e UI: Fix thread error on zip open failure. 2023-05-14 11:49:10 -07:00
Henrik Rydgård ee6234ecb6 I18N: Switch to getting categories by index instead of by string lookup
Also gets rid of the shared_ptr usage, and generally makes things nicer.

Needed for later config refactorings, good to get in early.
2023-04-07 10:35:01 +02:00
Henrik Rydgård 916404f0e4 Try to get a bit better at detaching threads that have used JNI from the VM. 2023-01-05 08:38:49 +01:00