Discussion:
[boost] Sanitizer bug or undefined behavior in format?
Olaf van der Spek via Boost
2017-06-19 10:10:13 UTC
Permalink
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Andrzej Krzemienski via Boost
2017-06-19 10:36:56 UTC
Permalink
2017-06-19 12:10 GMT+02:00 Olaf van der Spek via Boost <
Post by Olaf van der Spek via Boost
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?
This may be related to this bug report:
https://svn.boost.org/trac10/ticket/11632

Regards,
&rzej;

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Olaf van der Spek via Boost
2017-06-19 11:02:24 UTC
Permalink
On Mon, Jun 19, 2017 at 12:36 PM, Andrzej Krzemienski via Boost
Post by Andrzej Krzemienski via Boost
2017-06-19 12:10 GMT+02:00 Olaf van der Spek via Boost <
Post by Olaf van der Spek via Boost
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?
https://svn.boost.org/trac10/ticket/11632
Right, thx
Is Samuel still active?
--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Loading...