Opened 15 years ago
Last modified 13 years ago
#1587 closed Bugs
[program_options] crashes if value part missing in external configuration file — at Version 1
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | To Be Determined | Component: | program_options |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
NOTE: boost::program_options has a serious bug, so it'll crash if the value part of a setting is missing. E.g. the below snippet at the end of my settings.ini file crashes if I uncomment the last line.
log_fname_info = info.log log_fname_problems = problems.log log_fname_status = status.log #log_fname_verbose =
I want to use a blank setting to mean "no verbose log file" in the above code. I've flagged it showstopper for this reason.
It crashes on windows XP, in both debug and release versions, and normal and static link builds. Not tested on linux yet.
Specifically, it seems to be happening in po.store(), and (on windows at least) it is caught as an 'other exception' in the below code. e.what() just outputs '!'. The exception is arising in kernel32.dll apparently.
try{ po::store(po::parse_config_file(config_file,config_options), config_map); }catch(boost::program_options::invalid_option_value e){ std::cerr<<"invalid_option_value exception thrown parsing config file:"<<e.what()<<"\n"; return -2; }catch(std::exception e){ std::cerr<<"Other exception thrown parsing config file:"<<e.what()<<"\n!"; return -2; }