diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-11-06 19:16:46 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-11-06 19:16:46 +0300 |
commit | 64cd9a079b987e1ef3daf926bd5af26185e297a5 (patch) | |
tree | c97765e392afd910473c8a8fe6a39ca675529c73 /intern | |
parent | 65b414cfb291e8ae47e92ab1b101de3fa6d19704 (diff) |
Fix T70952: EXR files bigger than 2GB don't open on Windows
Diffstat (limited to 'intern')
-rw-r--r-- | intern/guardedalloc/intern/mmap_win.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c index 5b0c4b6614a..3508ae4e1aa 100644 --- a/intern/guardedalloc/intern/mmap_win.c +++ b/intern/guardedalloc/intern/mmap_win.c @@ -125,8 +125,11 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o } } - /* note len is passed to a 32 bit DWORD, so can't be > 4 GB */ - maphandle = CreateFileMapping(fhandle, NULL, prot_flags, 0, len, NULL); + /* Split 64 bit size into low and high bits. */ + DWORD len_bits_high = len >> 32; + DWORD len_bits_low = len & 0xFFFFFFFF; + + maphandle = CreateFileMapping(fhandle, NULL, prot_flags, len_bits_high, len_bits_low, NULL); if (maphandle == 0) { errno = EBADF; return MAP_FAILED; |