diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-05-04 15:49:38 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-05-04 22:45:02 +0100 |
commit | 789c57bc5fe023fc6dc72ade4afcb0916ff788d3 (patch) | |
tree | 691d1b22ff0b4b052833490eb4e1d2bcd687e60c /libstdc++-v3/include/std/future | |
parent | ca871701c2822c3c4537745d4aa44a7b8f408337 (diff) | |
download | gcc-789c57bc5fe023fc6dc72ade4afcb0916ff788d3.zip gcc-789c57bc5fe023fc6dc72ade4afcb0916ff788d3.tar.gz gcc-789c57bc5fe023fc6dc72ade4afcb0916ff788d3.tar.bz2 |
libstdc++: Fix undefined behaviour in std::string
This fixes a ubsan error when constructing a string with a null pointer:
bits/basic_string.h:534:21: runtime error: applying non-zero offset 18446744073709551615 to null pointer
The _M_construct function only cares whether the second pointer is
non-null, so create a non-null value without undefined arithmetic.
We can also pass the random_access_iterator_tag directly to the
_M_construct function, to avoid going via the tag dispatching
_M_construct_aux, because we know we have pointers not integers here.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string(const CharT*, const A&)):
Do not do arithmetic on null pointer.
Diffstat (limited to 'libstdc++-v3/include/std/future')
0 files changed, 0 insertions, 0 deletions