Opened 10 years ago

Closed 9 years ago

#8391 closed Bugs (fixed)

boost::local_time::tz_database::load_from_file uses unchecked iterator

Reported by: frank.oosterhuis@… Owned by: Marshall Clow
Milestone: Boost 1.54.0 Component: date_time
Version: Boost 1.53.0 Severity: Showstopper
Keywords: Cc: frank@…

Description

Program exits with:

/usr/local/include/boost/token_iterator.hpp:56: const Type& boost::token_iterator<TokenizerFunc, Iterator, Type>::dereference() const [with TokenizerFunc = boost::char_separator<char, std::char_traits<char> >, Iterator = gnu_cxx::normal_iterator<const char*, std::basic_string<char> >, Type = std::basic_string<char>]: Assertion `valid_' failed.

/boost/date_time/tz_db_base.hpp:

tokenizer_iterator tok_iter = tokens.begin();

tok_iter should be verified before using atoi().

Attachments (3)

main.cpp (553 bytes ) - added by frank.oosterhuis@… 10 years ago.
test program
date_time_zonespec.csv (334 bytes ) - added by frank.oosterhuis@… 10 years ago.
faulty csv
b8391.patch (808 bytes ) - added by frank.oosterhuis@… 10 years ago.
patch

Download all attachments as: .zip

Change History (10)

by frank.oosterhuis@…, 10 years ago

Attachment: main.cpp added

test program

by frank.oosterhuis@…, 10 years ago

Attachment: date_time_zonespec.csv added

faulty csv

comment:1 by frank.oosterhuis@…, 10 years ago

Milestone: To Be DeterminedBoost 1.54.0
Severity: ProblemShowstopper

by frank.oosterhuis@…, 10 years ago

Attachment: b8391.patch added

patch

comment:2 by frank@…, 10 years ago

Cc: frank@… added

comment:3 by Marshall Clow, 9 years ago

Owner: changed from az_sw_dude to Marshall Clow

When I run this test, I get execption: bad lexical cast: source type value could not be interpreted as target, and applying the supplied patch does not change this.

I agree there's a problem here, and I think that the code you're patching can be made more robust, but the bug that your code is triggering is (I think) not the one that your patch fixes.

Then again, I'm not running in gcc debug mode.

comment:4 by frank.oosterhuis@…, 9 years ago

I am not able to get the same execption (bad lexical cast). Always crashes with "Assertion `valid_' failed."

Tested with 1.53, 1.54_beta0 and trunk (r84644).

Compiled using: g++ -I ../boost_1_53_0 ./main.cpp -o ./bin/bug_boost_153 Version: gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)

comment:5 by Marshall Clow, 9 years ago

(In [84645]) More error checking on tz files; Refs #8391

comment:6 by frank.oosterhuis@…, 9 years ago

Fix confirmed.

boost::local_time::bad_field_count is now thrown.

comment:7 by Marshall Clow, 9 years ago

Resolution: fixed
Status: newclosed

(In [84755]) Apply patch to release branch; Fixes #8391

Note: See TracTickets for help on using tickets.