gcc/libstdc++-v3/include/ext
Jonathan Wakely 74270a546c libstdc++: Fix null pointer dereferences in __gnu_cxx::rope
This fixes UBsan errors like:

/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: member access within null pointer of type 'struct _RopeRep'
/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: member call on null pointer of type 'struct _Rope_rep_base'
/usr/include/c++/10/ext/rope:556:17: runtime error: reference binding to null pointer of type 'struct allocator_type'
/usr/include/c++/10/ext/ropeimpl.h:593:9: runtime error: reference binding to null pointer of type 'struct allocator_type'
/usr/include/c++/10/ext/rope:1700:30: runtime error: member call on null pointer of type 'struct new_allocator'
/usr/include/c++/10/ext/new_allocator.h:105:29: runtime error: member call on null pointer of type 'struct new_allocator'
/usr/include/c++/10/ext/rope:1702:26: runtime error: reference binding to null pointer of type 'const struct allocator'
/usr/include/c++/10/bits/allocator.h:148:34: runtime error: reference binding to null pointer of type 'const struct new_allocator'
/usr/include/c++/10/ext/rope:1664:39: runtime error: reference binding to null pointer of type 'const struct allocator'
/usr/include/c++/10/ext/rope:1665:9: runtime error: reference binding to null pointer of type 'const struct allocator_type'
/usr/include/c++/10/ext/rope:725:36: runtime error: reference binding to null pointer of type 'const struct allocator_type'
/usr/include/c++/10/ext/rope:614:64: runtime error: reference binding to null pointer of type 'const struct allocator_type'

The problem is calling r->_M_get_allocator() when r is null.

libstdc++-v3/ChangeLog:

	* include/ext/rope (rope::_S_concat_char_iter)
	(rope::_S_destr_concat_char_iter): Add allocator parameter.
	(rope::push_back, rope::append, rope::insert, operator+):
	Pass allocator.
	* include/ext/ropeimpl.h (rope::_S_concat_char_iter)
	(rope::_S_destr_concat_char_iter): Add allocator parameter
	and use it.
	(_Rope_char_ref_proxy::operator=(_CharT)): Pass allocator.
2020-12-02 12:29:00 +00:00
..
pb_ds
algorithm
aligned_buffer.h
alloc_traits.h
atomicity.h libstdc++: Use __libc_single_threaded to optimise atomics [PR 96817] 2020-09-26 20:32:36 +01:00
bitmap_allocator.h
cast.h
cmath
codecvt_specializations.h
concurrence.h
debug_allocator.h libstdc++: Fix some warnings in headers 2020-10-29 11:43:55 +00:00
enc_filebuf.h
extptr_allocator.h
functional
iterator
malloc_allocator.h libstdc++: Make allocators throw bad_array_new_length on overflow [LWG 3190] 2020-10-05 15:18:56 +01:00
memory
mt_allocator.h
new_allocator.h libstdc++: Make allocators throw bad_array_new_length on overflow [LWG 3190] 2020-10-05 15:18:56 +01:00
numeric
numeric_traits.h libstdc++: Simplify __numeric_traits definition 2020-11-12 14:36:39 +00:00
pod_char_traits.h
pointer.h
pool_allocator.h
random
random.tcc
rb_tree
rc_string_base.h
rope libstdc++: Fix null pointer dereferences in __gnu_cxx::rope 2020-12-02 12:29:00 +00:00
ropeimpl.h libstdc++: Fix null pointer dereferences in __gnu_cxx::rope 2020-12-02 12:29:00 +00:00
slist
sso_string_base.h
stdio_filebuf.h libstdc++: Override BUFSIZ for Windows targets [PR 94268] 2020-10-28 13:19:21 +00:00
stdio_sync_filebuf.h
string_conversions.h
throw_allocator.h libstdc++: Fix some warnings in headers 2020-10-29 11:43:55 +00:00
type_traits.h
typelist.h
vstring_fwd.h
vstring_util.h
vstring.h
vstring.tcc