Heap Overflow Vulnerability in OpenCV Package: CVE-2017-12603

opencv Updated 02 Oct 2025

Summary

07/08/2017
N/A
Yes i
High
8.8

CVE-2017-12603: OpenCV (Open Source Computer Vision Library) through 3.3 has an invalid write in the cv::RLByteStream::getBytes function in modules/imgcodecs/src/bitstrm.cpp when reading an image file by using cv::imread, as demonstrate... Affects opencv across 3 version ranges.

< 2a9d1b22ed76eb22fad1a5edf6faf4d05f207b13 < 3.2.0+dfsg-6 < e8357c0544c82beda237defc0abc90ee28992ee7

Fixed in 3.2.0+dfsg-6. How to fix ↓

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, or Open Source Computer Vision Library, is a widely used open-source library designed for computer vision and machine learning tasks. It provides a comprehensive set of tools for image processing, video analysis, and machine learning, making it a popular choice among developers and researchers. The library is utilized in various applications, from robotics to augmented reality. However, OpenCV versions up to 3.3 are susceptible to a critical vulnerability that can lead to heap overflow, potentially compromising the integrity of applications relying on this library.

Vulnerability Detail

CVE-2017-12603 is a heap overflow vulnerability found in the cv::RLByteStream::getBytes function within the imgcodecs module of OpenCV. This issue arises when the cv::imread function is used to read an image file, leading to an invalid write operation. The vulnerability can be exploited by an attacker to manipulate image files, resulting in arbitrary code execution or application crashes. The severity of this vulnerability is underscored by its CVSS score of 8.8, indicating a high risk to affected systems.

How To Fix

Minimum fixed version

3.2.0+dfsg-6

This is the first release that contains the fix.

sudo apt-get install --only-upgrade opencv

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

Workaround

If upgrading is not immediately feasible, consider implementing input validation to sanitize image files before processing them with OpenCV functions. This can help prevent the exploitation of the vulnerability by ensuring that only safe and correctly formatted image files are processed.

Conclusion

CVE-2017-12603 represents a significant security risk for applications using OpenCV versions up to 3.3. Users are strongly advised to upgrade to the fixed version to protect against potential exploitation. Additionally, utilizing tools like Vulert can help monitor and alert for open-source vulnerabilities in your software.

See every vulnerability recorded for opencv →

Share this vulnerability

FAQ

CVE-2017-12603 is a heap overflow vulnerability in OpenCV that can be exploited through the cv::imread function when reading image files.

Exploitation of this vulnerability can lead to arbitrary code execution, application crashes, or corruption of data.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The CVSS score for CVE-2017-12603 is 8.8, indicating a high severity level.

You can upgrade OpenCV by running the command 'sudo apt-get install opencv=3.2.0+dfsg-6' on Debian-based systems.

Related vulnerabilities

Recent vulnerabilities recorded for opencv.

How To Fix

Minimum fixed version

3.2.0+dfsg-6

This is the first release that contains the fix.

sudo apt-get install --only-upgrade opencv

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