CVE-2019-15939: Divide By Zero in OpenCV

opencv-python Updated 02 Oct 2025

Summary

12/10/2021
Yes i
Moderate
5.9

CVE-2019-15939: Divide By Zero in OpenCV. Affects opencv-python versions < 4.1.1.26. Fixed in 4.1.1.26. How to fix ↓

Also tracked for

The same CVE-2019-15939 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

OpenCV is an open-source computer vision library that provides various algorithms and functions for image and video processing. It is widely used in applications such as robotics, surveillance, and augmented reality. OpenCV-Python is a Python wrapper for the OpenCV library, allowing developers to utilize its functionality in Python-based projects. However, OpenCV 4.1.0 (OpenCV-Python 4.1.0.25) is affected by a divide-by-zero error in the cv::HOGDescriptor::getDescriptorSize function in the hog.cpp file of the objdetect module.

Vulnerability Detail

The divide-by-zero vulnerability in OpenCV can be exploited by an attacker to cause a denial of service (DoS) condition or potentially execute arbitrary code. The issue originates from a lack of proper input validation, allowing a divisor value of zero to be used in a calculation. As a result, a division operation triggers a divide-by-zero error, leading to a crash or unexpected behavior of the application using the vulnerable OpenCV version.

How To Fix

Latest published version: 5.0.0.93 as of 23 Oct 2026

pip install --upgrade "opencv-python==5.0.0.93"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.1.1.26

This is the first release that contains the fix.

pip install --upgrade "opencv-python==4.1.1.26"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating the OpenCV-Python package is not immediately feasible, a temporary workaround is to implement input validation before using the cv::HOGDescriptor::getDescriptorSize function. Developers can check if the divisor value is zero and handle the condition appropriately to prevent the divide-by-zero error. Here is an example of how to add input validation in Python:

def get_descriptor_size(hog_descriptor):
    if hog_descriptor.divisor == 0:
        # Handle the divide-by-zero condition
        return 0
    else:
        return hog_descriptor.getDescriptorSize()

Conclusion

In conclusion, OpenCV 4.1.0 (OpenCV-Python 4.1.0.25) is affected by a divide-by-zero vulnerability in the cv::HOGDescriptor::getDescriptorSize function. This vulnerability can result in a denial of service or potential execution of arbitrary code. It is crucial to update the OpenCV-Python package to version 4.1.1.26 or later to mitigate the risk. If immediate update is not possible, implementing input validation can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for opencv-python →

Share this vulnerability

FAQ

OpenCV is an open-source computer vision library that provides algorithms and functions for image and video processing.

OpenCV-Python is a Python wrapper for the OpenCV library, allowing developers to use OpenCV functionality in Python-based projects.

The vulnerability can lead to a denial of service (DoS) condition or potential execution of arbitrary code in applications using the vulnerable OpenCV version.

To fix the vulnerability, update the OpenCV-Python package to version 4.1.1.26 or later using the 'pip install --upgrade opencv-python' command.

Yes, a temporary workaround is to implement input validation before using the vulnerable function to prevent the divide-by-zero error.

Related vulnerabilities

Recent vulnerabilities recorded for opencv-python.

How To Fix

Latest published version: 5.0.0.93 as of 23 Oct 2026

pip install --upgrade "opencv-python==5.0.0.93"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

4.1.1.26

This is the first release that contains the fix.

pip install --upgrade "opencv-python==4.1.1.26"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback