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

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

https://gcc.gnu.org/g:4a051eb720e9fea04bd026f8b7eb6131e467037b

commit r17-5744-g4a051eb720e9fea04bd026f8b7eb6131e467037b
Author: Jonathan Wakely <[email protected]>
Date:   Thu Oct 29 11:36:05 2026 +0000

    libstdc++: Fix crash in pmr::unsynchronized_pool_resource [PR128264]

    There's an exception-safety bug in the initial allocation for a pool's
    chunks. If the allocation fails the exception is swallowed and the
    capacity has already been incorrectly set to a non-zero value. This
    leaves the pool in a corrupted state.

    There's no separate test for pmr::synchronized_pool_resource because
    that uses the same code and so will be fixed by this commit.

    libstdc++-v3/ChangeLog:

            PR libstdc++/128264
            * src/c++17/memory_resource.cc (_Pool::replenish): Rethrow
            exception.
            (_Pool::vector::insert): Use named variables for new capacity.
            For initial allocation only set capacity if allocation succeeds.
            * testsuite/20_util/unsynchronized_pool_resource/128264.cc: New
            test.

    Reviewed-by: Tomasz KamiÅski <[email protected]>

Reply via email to