Opened 12 years ago

Last modified 12 years ago

#4870 new Patches

ISO Timestamp Parsing Bug

Reported by: peter.klotz@… Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

boost::posix_time::from_iso_string() converts "20100713" into "20100713T201007.300000" which is obviously wrong.

The error is caused by boost::date_time::split().

The attached patch corrects split() so that an exception is thrown later in parse_delimited_time_duration().

The problem is reproducible in Boost 1.42.0 and 1.44.0.

This simple example demonstrates the issue:

const boost::posix_time::ptime time=boost::posix_time::from_iso_string("20100713"); std::cout << "Converted: " << boost::posix_time::to_iso_string(time) << std::endl;

Converted: 20100713T201007.300000

Maybe someone can apply this patch.

Attachments (1)

boost_1_42_0-DateTimeIsoParsingCheck.patch (644 bytes ) - added by peter.klotz@… 12 years ago.
Patch against Boost 1.42.0

Download all attachments as: .zip

Change History (5)

by peter.klotz@…, 12 years ago

Patch against Boost 1.42.0

comment:1 by viboes, 12 years ago

Type: BugsPatches

comment:2 by Katie Chan, 12 years ago

While the attached patch does work as expected, perhaps whether the resulting exception is the correct one should be considered. If not, that will need to be change as well.

Also, the wider design issue of whether to actually check for correct input at all. If yes, what other incorrectly formatted input string would need to be consider and whether it's being correctly check currently.

comment:3 by Marshall Clow, 12 years ago

(In [71191]) Applied patch; Refs #4870

comment:4 by Marshall Clow, 12 years ago

I've applied the patch - now let's talk about what else is needed to fix the problem.

First - should we have a test case for this?

Second - what is the desired behavior?

Note: See TracTickets for help on using tickets.