[PATCH 3/4] Fix undefined behaviour in libstdc++ testsuite

Jonathan Wakely jwakely@redhat.com
Thu Jul 21 19:47:00 GMT 2016


This one's a bit more involved. There are a number of calls to
char_traits<>::copy() and char_traits<>::compare() that incorrectly
use the length of the larger array, not the shorter one.

The specialization in testsuite/util/testsuite_character.cc was
setting a null terminator after the numpunct atoms, past the end of he
array.

    Fix out-of-bound array accesses in libstdc++ testsuite
    
    	* testsuite/21_strings/basic_string/modifiers/append/char/1.cc: Fix
    	reads past the end of strings.
    	* testsuite/21_strings/basic_string/operations/compare/char/1.cc:
    	Likewise.
    	* testsuite/21_strings/char_traits/requirements/short/1.cc: Fix
    	invalid array accesses.
    	* testsuite/experimental/string_view/operations/compare/char/1.cc:
    	Fix read past the end of string.
    	* testsuite/util/testsuite_character.cc: Fix out-of-bounds write.
 

Tested powerpc64-linux, committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 5895 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160721/24ae1551/attachment.bin>


More information about the Libstdc++ mailing list