This PR replaces the use of ftell() with platform-correct 64-bit file…#3064
Open
nidu-ninja wants to merge 2 commits intoAOMediaCodec:mainfrom
Open
This PR replaces the use of ftell() with platform-correct 64-bit file…#3064nidu-ninja wants to merge 2 commits intoAOMediaCodec:mainfrom
nidu-ninja wants to merge 2 commits intoAOMediaCodec:mainfrom
Conversation
… APIs when determining file size in avifIOCreateFileReader().
wantehchang
reviewed
Mar 2, 2026
| return NULL; | ||
| } | ||
| uint64_t fileSize = (uint64_t)fileSizeSigned; | ||
| #endif |
Collaborator
There was a problem hiding this comment.
NiDU-NINJA: Thank you for the pull request. We are in the middle of creating the libavif v1.4.0 release. I will review this PR next week.
Some preliminary comments.
- It is disappointing that C23 did not address the use of the
longtype infseek()andftell(). - I think your PR is correct. Since the
fseek()call at line 113 inavifIOFileReaderRead()needs the same treatment, it would be better to create libavif's own wrapper functions for thefseek()andftell()variants that support large files.- We can be POSIX-centric and provide
fseeko()andftello()wrappers for Windows, or - we can be neutral and provide
avifFseek64()andavifFtell64()for POSIX and Windows. - I can take care of the wrappers in a follow-up PR.
- We can be POSIX-centric and provide
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… APIs when determining file size in avifIOCreateFileReader().
The previous implementation relied on long, which may be 32-bit on some platforms, causing incorrect file size detection for files larger than 2GB.
The change ensures consistent and correct large-file handling across Windows and POSIX systems without altering public APIs or parsing behavior.