gcc/libstdc++-v3/testsuite/20_util/to_chars
Jonathan Wakely be50843754 libstdc++: Fix std::to_chars buffer overflow (PR 95851)
The __detail::__to_chars_2 function assumes it won't be called with zero
values. However, when the output buffer is empty the caller doesn't
handle zero values correctly, and calls __to_chars_2 with a zero value,
resulting in an overflow of the empty buffer.

The __detail::__to_chars_i function should just return immediately for
an empty buffer, and otherwise ensure zero values are handled properly.

libstdc++-v3/ChangeLog:

	PR libstdc++/95851
	* include/std/charconv (__to_chars_i): Check for zero-sized
	buffer unconditionally.
	* testsuite/20_util/to_chars/95851.cc: New test.
2020-06-24 12:28:13 +01:00
..
1.cc libstdc++: Restore ability to use <charconv> in C++14 (PR 94520) 2020-04-07 17:18:21 +01:00
2.cc libstdc++: Restore ability to use <charconv> in C++14 (PR 94520) 2020-04-07 17:18:21 +01:00
3.cc Update copyright years. 2020-01-01 12:51:42 +01:00
95851.cc libstdc++: Fix std::to_chars buffer overflow (PR 95851) 2020-06-24 12:28:13 +01:00
chars_format.cc Update copyright years. 2020-01-01 12:51:42 +01:00
compare.cc libstdc++: Add comparison operators to <charconv> result types 2020-04-08 16:16:10 +01:00
lwg3266.cc Update copyright years. 2020-01-01 12:51:42 +01:00
requirements.cc Update copyright years. 2020-01-01 12:51:42 +01:00