Skip to content

Commit

Permalink
Cherry pick memory map fix (#19835)
Browse files Browse the repository at this point in the history
### Description
<!-- Describe your changes. -->
Windows memory map casts mapped_offset to DWORD directly. It will be
truncated if it is larger than 2^32-1. We need to set high
dwFileOffsetHigh for this case.


### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

The bug was found from #19450

### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

Co-authored-by: Yufeng Li <[email protected]>
  • Loading branch information
maggie1059 and yufenglee authored Mar 11, 2024
1 parent 945a8aa commit b4b6b9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnxruntime/core/platform/windows/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ Status WindowsEnv::MapFileIntoMemory(_In_z_ const ORTCHAR_T* file_path,

void* const mapped_base = MapViewOfFile(file_mapping_handle.get(),
FILE_MAP_READ,
0,
static_cast<DWORD>(mapped_offset),
static_cast<DWORD>((mapped_offset >> 32) & 0xFFFFFFFF),
static_cast<DWORD>(mapped_offset & 0xFFFFFFFF),
mapped_length);
GSL_SUPPRESS(r.11)
mapped_memory =
Expand Down

0 comments on commit b4b6b9f

Please sign in to comment.