Source: pstreams
Version: 0.8.0-2

If you compile test_pstreams.cc with Undefined Behavior Sanitizer (-fsanitize=undefined -fsanitize-undefined-trap-on-error), the testsuite fails with the following backtrace:

#0  0x08053ec9 in move (__n=0, __s2=0x0, __s1=0x8068afa "") at 
/usr/include/c++/5/bits/char_traits.h:271
#1  redi::basic_pstreambuf<char, std::char_traits<char> >::fill_buffer 
(this=0xffffd070, non_blocking=false) at pstream.h:1833
#2  0x080540ef in redi::basic_pstreambuf<char, std::char_traits<char> 
>::underflow (this=0xffffd070) at pstream.h:1772
#3  0xf7ed78b4 in std::basic_istream<char, std::char_traits<char> >& std::getline<char, std::char_traits<char>, 
std::allocator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> >&, char) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4  0x0804d140 in getline<char, std::char_traits<char>, std::allocator<char> > 
(__str="", __is=...) at /usr/include/c++/5/bits/basic_string.h:5212
#5  main () at test_pstreams.cc:305


Apparently Pstreams calls std::char_traits::move() with destination buffer set to NULL, which is undefined behavior even when length is 0.

--
Jakub Wilk

Reply via email to