https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102259

--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<[email protected]>:

https://gcc.gnu.org/g:f4afecdce5275555973a032bbcf540caf037cbc2

commit r13-10321-gf4afecdce5275555973a032bbcf540caf037cbc2
Author: Jonathan Wakely <[email protected]>
Date:   Fri Dec 6 17:41:01 2024 +0000

    libstdc++: Add workaround for read(2) EINVAL on macOS and FreeBSD
[PR102259]

    On macOS and FreeBSD the read(2) system call can return EINVAL for large
    sizes, so limit the maximum that we try to read. The calling code in
    basic_filebuf::xsgetn will loop until it gets the size it wants, so we
don't
    need to loop in basic_file::xsgetn, just limit the maximum size.

    libstdc++-v3/ChangeLog:

            PR libstdc++/102259
            * config/io/basic_file_stdio.cc (basic_file::xsgetn): Limit n to
            _GLIBCXX_MAX_READ_SIZE if that macro is defined.
            * config/os/bsd/darwin/os_defines.h (_GLIBCXX_MAX_READ_SIZE):
            Define to INT_MAX-1.
            * config/os/bsd/freebsd/os_defines.h (_GLIBCXX_MAX_READ_SIZE):
            Likewise.

    (cherry picked from commit 4065bf7c2c61dd6eb19fdccbcda99000d8e44b7a)

Reply via email to