Ask Your Question

Revision history [back]

[4.2.0] FileStorage crash on getNodePtr() (Segmentation Fault)

Hi! I'm having a big issue with the FileStorage API with this YML file (pastebin). Basically, any time I try to access information on any FileNode, the program segfaults.

At first, I though it was due to my custom OpenCV build on macOS, but after trying with the pre-built OpenCV 4.2.0 Windows binaries, the problem persists.

Messing around in LLDB i figured that the crash happens in cv::FileStorage::Impl::getNodePtr(unsigned long, unsigned long)

The relevant code segment is:

cv::FileStorage fs;
try{
    fs = cv::FileStorage(filePath, cv::FileStorage::READ);
}catch(cv::Exception ex)
{
    return 1;
}

cv::FileNode node = fs.root();

std::cout << "Got root node" << std::endl;
std::cout << "Root node is type: " << node.type() << std::endl; //Crash here

I'm really at a loss... any help is appreciated.