Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0] Avoid signed overflow in DBG_FlushInstructionCache #106823

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/pal/src/thread/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2068,12 +2068,12 @@ DBG_FlushInstructionCache(
// As a workaround, we call __builtin___clear_cache on each page separately.

const SIZE_T pageSize = GetVirtualPageSize();
INT_PTR begin = (INT_PTR)lpBaseAddress;
const INT_PTR end = begin + dwSize;
UINT_PTR begin = (UINT_PTR)lpBaseAddress;
const UINT_PTR end = begin + dwSize;

while (begin < end)
{
INT_PTR endOrNextPageBegin = ALIGN_UP(begin + 1, pageSize);
UINT_PTR endOrNextPageBegin = ALIGN_UP(begin + 1, pageSize);
if (endOrNextPageBegin > end)
endOrNextPageBegin = end;

Expand Down
Loading