CommandLineParser crashed (Bug #2471)


Added by Andrey Morozov over 12 years ago. Updated over 12 years ago.


Status:Done Start date:2012-10-25
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:3.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

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 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

Also available in: Atom PDF