Boost logo

Boost :

From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2006-04-22 05:59:30


Hi,

I think there's a bug in the program options library. It appears to
dereference an invalid string iterator.

libs\program_options\src\value_semantic.cpp:
    void validate(any& v, const vector<string>& xs, std::string*, int)
    {
        check_first_occurrence(v);
        string s(get_single_string(xs));
        if (*s.begin() == '\'' && *s.rbegin() == '\'' ||
            *s.begin() == '"' && *s.rbegin() == '"')
            v = any(s.substr(1, s.size()-2));
        else
            v = any(s);
    }

A !s.empty() check should be added.



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk