An issue was discovered in OpenCV before 4.1.1. There is a NULL pointer dereference in the function cv::XMLParser::parse at modules/core/src/persistence.cpp. Reference: https://github.com/opencv/opencv/compare/371bba8...ddbd10c https://github.com/opencv/opencv/issues/15127
Created opencv tracking bugs for this issue: Affects: fedora-all [bug 1797451]
Upstream fix: https://github.com/opencv/opencv/commit/5691d998ead1d9b0542bcfced36c2dceb3a59023
The flaw lies in the implementation of Cascade Classifier, an algorithm used internally by OpenCV to detect objects in digital images. It is a machine learning based algorithm where a classifier is trained from a lot of "positive" and "negative" images, and then used to detect objects in other images. Specifically, the NULL pointer dereference can be triggered when the classifier (in the form of a XML file) is loaded and parsed by the cv::CascadeClassifier::load() function.
This flaw was apparently introduced in OpenCV upstream version 4.0.0 with commit https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a. This commit replaced function icvXMLSkipSpaces() with skipSpaces() in persistence_xml.cpp; the new implementation made it possible for skipSpaces() to return a NULL pointer: https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a#diff-c9729b5bab1646d0cf30a15a7de41fd5R416. Conversely, the older implementation took care of re-initializing the NULL pointer before returning it: https://github.com/opencv/opencv/commit/0f622206e48f6050536f00d47abf47c4a2d1824a#diff-c9729b5bab1646d0cf30a15a7de41fd5L81.
Statement: This flaw did not affect the versions of OpenCV as shipped with Red Hat Enterprise Linux 6, 7, and 8 as they did not include the vulnerable code, which was introduced in a newer version of the library.
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s): https://access.redhat.com/security/cve/cve-2019-14493
Mitigation: Avoid loading cascade classifiers from external untrusted sources.