Merge yuzu-emu#13166

This commit is contained in:
yuzubot 2024-02-27 00:57:11 +00:00
parent 29fa1417fa
commit 4052ffb97b
1 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,9 @@ public:
void Track(u64 offset, u64 size) noexcept { void Track(u64 offset, u64 size) noexcept {
const size_t page = offset >> PAGE_SHIFT; const size_t page = offset >> PAGE_SHIFT;
const size_t page_end = (offset + size) >> PAGE_SHIFT; const size_t page_end = (offset + size) >> PAGE_SHIFT;
if (page_end < page || page_end >= pages.size()) {
return;
}
TrackPage(page, offset, size); TrackPage(page, offset, size);
if (page == page_end) { if (page == page_end) {
return; return;
@ -41,6 +44,9 @@ public:
[[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept { [[nodiscard]] bool IsUsed(u64 offset, u64 size) const noexcept {
const size_t page = offset >> PAGE_SHIFT; const size_t page = offset >> PAGE_SHIFT;
const size_t page_end = (offset + size) >> PAGE_SHIFT; const size_t page_end = (offset + size) >> PAGE_SHIFT;
if (page_end < page || page_end >= pages.size()) {
return false;
}
if (IsPageUsed(page, offset, size)) { if (IsPageUsed(page, offset, size)) {
return true; return true;
} }