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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

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

commit r15-7627-gee6619b1246b38cfb36f6efd931a6f475a9033c7
Author: David Malcolm <dmalc...@redhat.com>
Date:   Wed Feb 19 09:46:43 2025 -0500

    input: give file_cache_slot its own copy of the file path [PR118919]

    input.cc's file_cache was borrowing copies of the file name.
    This could lead to use-after-free when writing out sarif output
    from Fortran, which frees its filenames before the sarif output
    is fully written out.

    Fix by taking a copy in file_cache_slot.

    gcc/ChangeLog:
            PR other/118919
            * input.cc (file_cache_slot::m_file_path): Make non-const.
            (file_cache_slot::evict): Free m_file_path.
            (file_cache_slot::create): Store a copy of file_path if non-null.
            (file_cache_slot::~file_cache_slot): Free m_file_path.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Reply via email to