CommandLineParser crashed (Bug #2471)
Description
If I use wrong syntax then parser is crashed.
For example(main.cpp):
#include <opencv2/opencv.hpp> #include <iostream> #include <string> const std::string keys = "{ b | bug | 42 | it's a bug }" "{ h | help | | | help info }" "{ | i | 7 | i - int }" ; int main(int argc, char ** argv) { cv::CommandLineParser parser(argc, argv, keys); if (parser.has("help")) { parser.printMessage(); return 0; } int a = parser.get<int>("i"); int b = parser.get<int>("b"); std::cout << a << std::endl; std::cout << b << std::endl; if (!parser.check()) { parser.printErrors(); return 0; } return 0; }
History
Updated by Andrey Morozov over 12 years ago
I fixed it.
https://github.com/Itseez/opencv/pull/104
Updated by Vadim Pisarevsky over 12 years ago
Is this the version of CommandLineParser from the branch 2.4 (NNSU students version) or the master (your version)?
Updated by Andrey Morozov over 12 years ago
master
Updated by Vadim Pisarevsky over 12 years ago
I guess, your patch, which fixes the bug, was applied recently. If not, please, reopen the ticket
- Status changed from Open to Done
Updated by Andrey Kamaev over 12 years ago
- Target version changed from 2.4.3 to 3.0