# CVE-2017-12864: PYSEC-2026-697 - Integer Overflow or Wraparound in OpenCV

Source: https://junglewise.ai/threats/cve-2017-12864-opencv-integer-overflow-in-pxm-image-parsing  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-02. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2017-12864 · Severity: low · CVSS 3 · Published 2026-07-02

OpenCV, a widely-used computer vision library, contains an integer overflow vulnerability in its PXM image file format parser. When processing a maliciously crafted image file from an untrusted source, the vulnerability can lead to denial of service or remote code execution.

Technologies: [OpenCV](https://junglewise.ai/threats/technologies/opencv), [opencv-contrib-python (PyPI)](https://junglewise.ai/threats/technologies/opencv-contrib-python), [opencv-python (PyPI)](https://junglewise.ai/threats/technologies/opencv-python). Vendors: [OpenCV](https://junglewise.ai/threats/vendors/opencv), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2017-12864 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2017-12864 being exploited in the wild.

**How severe is CVE-2017-12864?** Low severity, with a CVSS score of 3, published 2 July 2026.

**Which products and versions are affected?** OpenCV 3.3.0.9 and earlier; opencv-contrib-python (PyPI) ECOSYSTEM:introduced=0,fixed=3.3.1.11; opencv-python (PyPI) ECOSYSTEM:introduced=0,fixed=3.3.1.11.

**Is there a fix for CVE-2017-12864?** Yes. opencv-contrib-python (PyPI): upgrade to 3.3.1.11 or later; opencv-python (PyPI): upgrade to 3.3.1.11 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2017-12864 attacked?** It is attacked over the network.

**Am I affected by CVE-2017-12864?** Check whether you run OpenCV, opencv-contrib-python (PyPI) or opencv-python (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- opencv-contrib-python (PyPI): upgrade to 3.3.1.11 or later

  ```sh
  pip install "opencv-contrib-python>=3.3.1.11"
  ```

- opencv-python (PyPI): upgrade to 3.3.1.11 or later

  ```sh
  pip install "opencv-python>=3.3.1.11"
  ```


## Technical details

The vulnerability is an integer overflow (CWE-190) in the ReadNumber function within opencv/modules/imgcodecs/src/grfmt_pxm.cpp. The function fails to validate input length before performing arithmetic operations on pixel dimension values, allowing an attacker to trigger signed integer overflow. The attack vector is network-based if the image is sourced remotely; it requires processing a maliciously crafted PXM image file without strict input validation. Successful exploitation can result in denial of service or remote code execution. The vulnerability was patched in OpenCV 3.3.1.11.

## Affected products

- OpenCV OpenCV 3.3.0.9 and earlier
- OpenCV opencv-python 3.3.0.9 and earlier
- OpenCV opencv-contrib-python 3.3.0.9 and earlier

## Identifiers

- CVE-2017-12864
- GHSA-267x-w5hx-8hjr
- PYSEC-2026-2804
- PYSEC-2026-697

## Timeline

- 2017-08-15: disclosed
- 2017: patched: Fixed in OpenCV 3.3.1.11
- 2021-10-12: advisory

## References

- [https://github.com/opencv/opencv/issues/9372](https://github.com/opencv/opencv/issues/9372)

## Related threats

- [PYSEC-2026-705 - Out-of-bounds Write in OpenCV.](https://junglewise.ai/threats/cve-2018-5268-out-of-bounds-write-in-opencv)
- [PYSEC-2026-725 - Out-of-bounds Write in OpenCV](https://junglewise.ai/threats/cve-2019-5064-out-of-bounds-write-in-opencv)
- [PYSEC-2026-724 - Out-of-bounds Write in OpenCV](https://junglewise.ai/threats/cve-2019-5063-out-of-bounds-write-in-opencv)
- [PYSEC-2026-723 - Out-of-bounds Read in OpenCV](https://junglewise.ai/threats/cve-2019-19624-out-of-bounds-read-in-opencv)
- [PYSEC-2026-719 - Out-of-bounds Write in OpenCV](https://junglewise.ai/threats/cve-2019-9423-out-of-bounds-write-in-opencv)
