Skip to content

exception thrown: bad_lexical_cast  #30

@thomas955

Description

@thomas955

Hi,

we discovered, that boost crashes with "bad_lexical_cast" if we provide an empty "string" as parameter.
Tested with boost 1.58.0 and 1.63.0

Cli input to reproduce: sleep ""

gdb Backtrace (catch throw) with boost_ver: 1.58.0

#0  0x00007ffff2cbbd90 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x000000000049a12e in boost::throw_exception<boost::bad_lexical_cast> (e=...) at path/gcc48/include/boost-1_58_1/boost/throw_exception.hpp:69
#2  0x00007ffff739ea91 in boost::conversion::detail::throw_bad_cast<std::string, unsigned int> () at path/gcc48/include/boost-1_58_1/boost/lexical_cast/bad_lexical_cast.hpp:92
#3  0x00007ffff739e123 in boost::lexical_cast<unsigned int, std::string> (arg="") at path/gcc48/include/boost-1_58_1/boost/lexical_cast.hpp:42
#4  0x00007ffff739d901 in boost::program_options::validate<unsigned int, char> (v=..., xs=std::vector of length 1, capacity 1 = {...})
    at path/gcc48/include/boost-1_58_1/boost/program_options/detail/value_semantic.hpp:89
#5  0x00007ffff739d44c in boost::program_options::typed_value<unsigned int, char>::xparse (this=0x70fff0, value_store=..., new_tokens=std::vector of length 1, capacity 1 = {...})
    at path/gcc48/include/boost-1_58_1/boost/program_options/detail/value_semantic.hpp:167
#6  0x00007ffff4c6f0b5 in boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const ()
   from path/gcc48/lib/x86_64-linux-gnu/libboost_program_options-gcc48-mt-1_58_1.so.1.58.1
#7  0x00007ffff4c6b1da in boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool) ()
   from path/gcc48/lib/x86_64-linux-gnu/libboost_program_options-gcc48-mt-1_58_1.so.1.58.1
#8  0x00007ffff74a08f8 in program_name::cli::namespace_version::bindCommandline (tokens=..., startIdx=0, opts=..., popts=..., vmap=...)

content of 'boost::program_options::basic_parsed_options const&' :

{options = std::vector of length 1, capacity 1 = {{string_key = "time", position_key = 0, value = std::vector of length 1, capacity 1 = {""}, original_tokens = std::vector of length 1, capacity 1 = {""}, 
      unregistered = false, case_insensitive = false}}, description = 0x7ffff788b620 <program_name::cli::namespace_version::POConsoleInput::s_sleepOptions>, m_options_prefix = 1}

Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions