Opened 17 years ago

Closed 17 years ago

#584 closed Bugs (Fixed)

boost::format and empty string crash in MSVC 8.0

Reported by: adalx Owned by: samuel_k
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

std::string x;
cout << boost::format("%s") % x;

MSVC 8.0 will assert because of a NULL pointer.

This was also reported here with details:
http://lists.boost.org/Archives/boost/2006/01/99194.php

Change History (2)

comment:1 by adalx, 17 years ago

Logged In: YES 
user_id=1067739

The fix is simple. At line 48 in /boost/format/feed_args.hpp:

res.append(beg, size);

must be replaced with:

if (size)
  res.append(beg, size);

comment:2 by cepstein, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=36183

Fixed on TRUNK (feed_args.hpp 1.29) and RC_1_34_0 (1.28.6.1).
Note: See TracTickets for help on using tickets.