Opened 7 years ago

Closed 7 years ago

#11956 closed Bugs (wontfix)

NULL values to a basic_formatting_ostream causes an error

Reported by: Erich Keane <erich.keane@…> 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).

Change History (1)

comment:1 by Andrey Semashev, 7 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.