[PATCH] PR libstdc++/89446 fix null pointer dereference in char_traits

Jonathan Wakely jwakely@redhat.com
Sat Feb 23 03:00:00 GMT 2019


On 23/02/19 01:26 +0000, Jonathan Wakely wrote:
>On 23/02/19 02:06 +0100, Jakub Jelinek wrote:
>>On Sat, Feb 23, 2019 at 01:02:20AM +0000, Jonathan Wakely wrote:
>>>	PR libstdc++/89446
>>>	* include/bits/char_traits.h (__constant_char_array): Check index is
>>>	in range before dereferencing.
>>>	* testsuite/21_strings/basic_string_view/operators/char/89446.cc:
>>>	New test.
>>>
>>>Tested x86_64-linux, committed to gcc-8-branch and gcc-7-branch.
>>
>>And not trunk?  The bug is still there, even when it should be usually
>>ifdefed out because __builtin_is_constexpr_evaluated() should be supported.
>
>Yes, that's a bigger patch (with some cleanup) which is coming
>shortly.

Here's the patch for trunk. When the size is zero we can just return,
we don't need to do the __builtin_constant_p checks.

Tested powerpc64le-linux, committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 7677 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190223/17311ec0/attachment.bin>


More information about the Libstdc++ mailing list