Skip to content

Vulnerability fixes (3/3) - #22014

Merged
hrydgard merged 8 commits into
masterfrom
vuln-fixes-3
Aug 1, 2026
Merged

Vulnerability fixes (3/3)#22014
hrydgard merged 8 commits into
masterfrom
vuln-fixes-3

Conversation

@hrydgard

@hrydgard hrydgard commented Aug 1, 2026

Copy link
Copy Markdown
Owner

gameName/saveName/fileName and the saveNameList entries are
guest-controlled and get concatenated into host filesystem paths, so a
crafted request could escape the save directory with ../ sequences.

- PSPSaveDialog::Init rejects requests whose name fields contain a path
  separator ('/' or '\') or are bare dot components.
- SavedataParam::SetPspParam rejects saveNameList entries the same way.
Replace the inline lambdas in the savedata dialog with the new
HasPathTraversal() helper in Core/Util/PathUtil.
SeekFile stored a signed s32 position into the unsigned size_t seekPos,
so a negative position (e.g. from a truncating s32 cast of a large
lseek offset) wrapped seekPos to near 2^64. ReadFile's clamp arithmetic
then also wrapped, driving a memcpy from a wild pointer.

- Clamp the computed seek position to 0 in SeekFile.
- Clamp the read size against the remaining data in ReadFile, returning
  0 when seekPos is at or past the end.
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.
The space-left clamp was computed in unsigned 32-bit arithmetic, so a
crafted fileoffset/FirstOffsetExtra could underflow to a huge value and
leave addbytes unclamped, driving a Memory::Memcpy past dataBuf_.

Compute the clamp in signed 64-bit, clamp negatives to 0, and skip the
copy when there's nothing to write.
nm.nsegment is attacker-controlled but segmentaddr/segmentsize are fixed
4-entry arrays; the debug info loop read past them. Clamp to 4 like the
other consumers.
… savestate migration

Texture pack filenames/aliases from textures.ini were used to build read
and write paths with no '..' check, letting a malicious pack read or
write files outside the pack directory.

- LoadIniValues rejects entries with a parent dir component via
  HasParentDirComponent.
- ReplacedTexture::Prepare skips such filenames as defense in depth.
- PSPLoaders savestate migration now uses the shared HasPathTraversal
  helper instead of inline separator checks.
Vuln 17: ReplacedTexture::LoadLevelData let a KTX2/DDS file at a higher
mip level resize the shared data_ vector to its own (attacker-controlled)
mip count, so data_[mipLevel + i] indexed out of bounds and the KTX2
branch resized a different element than it wrote to. Disallow mixing
image formats across mip levels, cap the container mip count, and resize
the same element that is used as the transcode destination.

Vuln 18: DecodeTextureLevel only validated the start address for
non-DXT textures, so guest-controlled w/h/bufw could drive reads past
mapped RAM. Validate the needed range like the DXT path does and clamp
the height; ReadIndexedTex now takes the clamped w/h.
@hrydgard hrydgard added this to the v1.21 milestone Aug 1, 2026
@hrydgard
hrydgard merged commit 49fb4f9 into master Aug 1, 2026
23 checks passed
@hrydgard
hrydgard deleted the vuln-fixes-3 branch August 1, 2026 12:21
@daniloxavier183-max

Copy link
Copy Markdown

O jogo tá travando demais Midnight Club 3 DUB Edition e também o PSP fica saindo sozinho mesmo assim se eu desativar continua saindo e esse jogo que eu levei você tá travando antes não travava quando o Java versão do site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants