Skip to content

fix(filesystem): Use 64-bit file offsets on Windows - #5354

Merged
lgritz merged 2 commits into
AcademySoftwareFoundation:mainfrom
Maxi741cv:fix-mingw-large-file-seek
Jul 31, 2026
Merged

fix(filesystem): Use 64-bit file offsets on Windows#5354
lgritz merged 2 commits into
AcademySoftwareFoundation:mainfrom
Maxi741cv:fix-mingw-large-file-seek

Conversation

@Maxi741cv

@Maxi741cv Maxi741cv commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

Use _fseeki64() and _ftelli64() on all Windows builds. MinGW does not
define _MSC_VER, so it previously used fseeko() and ftello(), which can
have 32-bit offsets.

Fixes #5351.

Tests

  • clang-format --dry-run --Werror src/libutil/filesystem.cpp
  • git diff --check
  • Verified that oiiotool --stats reads the reproducing EXR successfully

Use _fseeki64 and _ftelli64 for all Windows builds, including MinGW, instead of selecting them only for MSVC.

Fixes #5351

Signed-off-by: Mixie <brincv777@gmail.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 31, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Maxi741cv / name: Mixie (6407226)

MinGW defines __int64 as long long, for which functional cast syntax is invalid. Use static_cast so the Windows code compiles with both GCC and MSVC.

Signed-off-by: Mixie <brincv777@gmail.com>

@lgritz lgritz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix

@lgritz
lgritz merged commit 759ee33 into AcademySoftwareFoundation:main Jul 31, 2026
29 checks passed
@Maxi741cv
Maxi741cv deleted the fix-mingw-large-file-seek branch August 3, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Filesystem::fseek truncates offsets above 2 GiB in MinGW builds

2 participants