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

Fix get_file_size behavior inconsistency for folders #561

Merged
merged 2 commits into from
Apr 21, 2023
Merged

Commits on Apr 15, 2023

  1. Fix get_file_size behavior inconsistency for folders

    Different OSes have different behavior when trying to fopen/fseek/ftell
    a folder. On Linux, some systems return 0 size, some systems return an
    error, and some systems return LONG_MAX. LONG_MAX is particularly
    problematic because that causes spurious OOMs under address sanitizer.
    
    Using fstat manually cleans this up, however it introduces a new
    dependency on platform specific headers that we didn't have before, and
    also has unclear behavior on 64-bit systems wrt 32-bit sizes which will
    need to be tested further as I'm not certain if the behavior needs to be
    special-cased only for MSVC/MinGW, which are currently not handled by
    this path (unless MinGW defines __unix__...)
    zeux committed Apr 15, 2023
    Configuration menu
    Copy the full SHA
    d3199a0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a13b5cc View commit details
    Browse the repository at this point in the history