|
Boost : |
Subject: [boost] Sanitizer bug or undefined behavior in format?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2017-06-19 10:10:13
Hi,
I think it's about rdbuf() which doesn't appear to be virtual. Is this
a bug in the sanitizer or is this call not allowed?
alt_sstream.hpp:
basic_oaltstringstream(stringbuf_t * buf)
: pbase_type(buf, No_Op() ), stream_t(rdbuf())
{ }
$ g++ a.cpp -fsanitize=undefined && ./a.out
/usr/include/boost/format/alt_sstream.hpp:146:60: runtime error:
member call on address 0x7fffdb4f36a0 which does not point to an
object of type 'basic_oaltstringstream'
0x7fffdb4f36a0: note: object has invalid vptr
00 00 00 00 00 00 00 00 00 00 00 00 18 3a 4f db ff 7f 00 00 b0 4c
37 fa 66 55 00 00 28 5b 0d 80
^~~~~~~~~~~~~~~~~~~~~~~
invalid vptr
a.cpp:
#include <iostream>
int main()
{
std::cout << boost::format("%d") % 1 << std::endl;
// std::cout << boost::format("%04d-%02d-%02d") % (date->tm_year +
1900) % (date->tm_mon + 1) % date->tm_mday << std::endl;
return 0;
}
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk