Modify

Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#704 closed Bugs (fixed)

format zero length string msvc-8

Reported by: drjohnfoster Owned by: Samuel Krempp
Milestone: Boost 1.35.0 Component: format
Version: None Severity: Problem
Keywords: Cc:

Description (last modified by René Rivera)

Since Microsoft have deprecated most of the standard 
library, their debug libraries also check for unsafe 
pointers. The following code gives an assertion:

(boost::format("%s") % "").str();

In debug mode, basic_string<char>::append(0, 0) 
called from mk_str in feed_args.hpp is tested by the 
macro _DEBUG_POINTER, and decides the pointer is 
invalid even though the count is 0.

I imagine this toxic behaviour is repeated in a 
number of places. It would be nice if the boost 
library could work around this problem at a low level.

Attachments (0)

Change History (7)

comment:1 Changed 11 years ago by nobody

Logged In: NO 

According to the C++ standard, basic_string<char>::append(0, 0) returns

basic_string<char>::append(basic_string<char>(0,0))

The standard specifically says the pointer shall not be a null.

So I believe that this was a bug in the boost format library, rather than a problem with the MSVC library. 

comment:2 Changed 11 years ago by magic_op

Logged In: YES 
user_id=1562825
Originator: NO

This will also happen with an empty string (instead of just a character array/pointer)

std::string my_string;
(boost::format("%1%") % my_string).str();

comment:3 Changed 10 years ago by Samuel Krempp

Owner: changed from samuel_k to Samuel Krempp
Severity: Problem
Status: assignednew

comment:4 Changed 10 years ago by Samuel Krempp

Status: newassigned

comment:5 Changed 10 years ago by René Rivera

Component: Noneformat
Description: modified (diff)

comment:6 Changed 10 years ago by John Maddock

Milestone: Boost 1.35.0
Resolution: Nonefixed
Status: assignedclosed

This appear to be fixed (and tested for) in SVN Trunk. So I'm closing the issue down: please reopen if it resurfaces.

comment:7 Changed 9 years ago by Alvaro

Death was Nature's way of telling you to slow down.

-- (Terry Pratchett, Strata)

viagra prezzo fioricet canada come comprare cialis generico prices tramadol

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Samuel Krempp.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.