]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix incorrect size calculation in PMR resource (PR 94906)
authorJonathan Wakely <jwakely@redhat.com>
Tue, 12 May 2020 08:54:44 +0000 (09:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 12 May 2020 08:54:44 +0000 (09:54 +0100)
commitdc103060c18656affaecfdd57faa4e0237dadcd3
tree9ef3c3ce6d413ce346c2ec08bcb2dc1aede23b56
parent8836c35d5d6fefa514cb78cb6800670869fb1df2
libstdc++: Fix incorrect size calculation in PMR resource  (PR 94906)

Calculating the size of a chunk being returned to the upstream allocator
was done with a 32-bit type, so it wrapped if the chunk was 4GB or
larger.

I don't know how to test this without allocating 4GB, so there's no test
in the testsuite. It has been tested manually of course.

Backport from mainline
2020-05-04  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/94906
* src/c++17/memory_resource.cc
(monotonic_buffer_resource::_Chunk::release): Use size_t for shift
operands.
libstdc++-v3/ChangeLog
libstdc++-v3/src/c++17/memory_resource.cc