Opened 7 years ago
Closed 7 years ago
#11956 closed Bugs (wontfix)
NULL values to a basic_formatting_ostream causes an error
Reported by: | Owned by: | Andrey Semashev | |
---|---|---|---|
Milestone: | To Be Determined | Component: | log |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
Doing the following causes a segfault:
char* msg = nullptr; BOOST_LOG_TRIVIAL(trace) << msg;
It causes a call to std::char_traits<char>::length on the 'msg' above, which causes a segfault.
I would anticipate that this functionality match the standard ostream version of the same thing, which is to not print at all, or at least the printf formatting, which prints (null).
Note:
See TracTickets
for help on using tickets.
This is not a bug in the library. Null C-style strings are not a valid data to output - neither with iostreams nor with printf nor with Boost.Log.