Commit 5d946f42 by Jonathan Wakely Committed by Jonathan Wakely

re PR libstdc++/66354 ([UBSAN] stl_algobase.h:708:7: runtime error: null pointer…

re PR libstdc++/66354 ([UBSAN] stl_algobase.h:708:7: runtime error: null pointer passed as argument)

	PR libstdc++/66354
	* include/bits/stl_algobase.h (__fill_a): Check length before calling
	memset.

From-SVN: r223906
parent 1edfb384
2015-05-31 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/66354
* include/bits/stl_algobase.h (__fill_a): Check length before calling
memset.
2015-05-30 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_algobase.h (__equal<true>::equal): Check length
......
......@@ -705,8 +705,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__fill_a(_Tp* __first, _Tp* __last, const _Tp& __c)
{
const _Tp __tmp = __c;
__builtin_memset(__first, static_cast<unsigned char>(__tmp),
__last - __first);
if (const size_t __len = __last - __first)
__builtin_memset(__first, static_cast<unsigned char>(__tmp), __len);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment