[PR #3556] [MERGED] Core: Improve memory address validation logic #3570

Closed
opened 2026-02-27 22:04:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/3556
Author: @StevenMiller123
Created: 9/8/2025
Status: Merged
Merged: 9/9/2025
Merged by: @squidbus

Base: mainHead: vma-map-fix


📝 Commits (1)

  • 945bf14 Core: Improve memory address validation logic

📊 Changes

1 file changed (+28 additions, -17 deletions)

View changed files

📝 src/core/memory.cpp (+28 -17)

📄 Description

When I added memory address validation in #2872, I missed that we already had a IsValidAddress function that could be used for ensuring addresses are within our vma map. While it may be slightly slower, IsValidAddress should be more reliable for detecting issues, particularly on Windows platforms where standard library iterators seem to run into a bunch of weird random behavior with these edge cases.

This should make memory asserts more consistent, and in some cases replace some exceptions with memory asserts.

I suspect IsValidAddress isn't fully reliable for Mac platforms, since from what I can tell, it doesn't do any extra checks to handle the address space gaps on that platform. If more rigid checks for dealing with address space gaps is desired, I can add that to this PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/3556 **Author:** [@StevenMiller123](https://github.com/StevenMiller123) **Created:** 9/8/2025 **Status:** ✅ Merged **Merged:** 9/9/2025 **Merged by:** [@squidbus](https://github.com/squidbus) **Base:** `main` ← **Head:** `vma-map-fix` --- ### 📝 Commits (1) - [`945bf14`](https://github.com/shadps4-emu/shadPS4/commit/945bf146276ff8e1a154558cee1072c16f140b2a) Core: Improve memory address validation logic ### 📊 Changes **1 file changed** (+28 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/core/memory.cpp` (+28 -17) </details> ### 📄 Description When I added memory address validation in #2872, I missed that we already had a IsValidAddress function that could be used for ensuring addresses are within our vma map. While it may be slightly slower, IsValidAddress should be more reliable for detecting issues, particularly on Windows platforms where standard library iterators seem to run into a bunch of weird random behavior with these edge cases. This should make memory asserts more consistent, and in some cases replace some exceptions with memory asserts. I suspect IsValidAddress isn't fully reliable for Mac platforms, since from what I can tell, it doesn't do any extra checks to handle the address space gaps on that platform. If more rigid checks for dealing with address space gaps is desired, I can add that to this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 22:04:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#3570
No description provided.