---
id: "CVE-2026-119340"
kind: "vulnerability"
aliases: ["CVE-2026-119340"]
title: "Tesseract OCR: crafted traineddata file can crash or corrupt memory"
severity: "medium"
cvss: 5.5
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["node", "ocr", "package", "python", "self-hosted", "tesseract"]
not_affected_if: ["trusted-traineddata-only", "version-5.5.4-or-later"]
published_at: "2026-10-30T21:16:52+00:00"
first_seen_at: "2026-10-30T21:25:52+00:00"
updated_at: "2026-10-30T21:26:55+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-119340", "first_seen_at": "2026-10-30T21:25:52+00:00"}]
---

# Tesseract OCR: crafted traineddata file can crash or corrupt memory

Tesseract, an open source OCR engine, fails to validate matrix dimensions when loading a traineddata file, so negative or oversized values lead to inconsistent allocation and out-of-bounds access. An attacker who supplies a crafted traineddata file can cause a denial of service.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Run `tesseract --version` to see which Tesseract version is installed.
- Check whether your build of Tesseract loads traineddata files from untrusted sources.

## Fix

- Move Tesseract to `5.5.4` or later.

## Timeline

- 2026-10-30T21:25:52+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-119340

## From the sources

Tesseract is an open source OCR engine. Prior to 5.5.4, GENERIC_2D_ARRAY::DeSerializeSize in src/ccstruct/matrix.h reads matrix dimensions as signed int32_t values and compares them only with UINT16_MAX, allowing negative values to reach ResizeNoInit. Negative dimensions or a 65535 by 65535 product can create inconsistent allocation state and later out-of-bounds accesses while loading a crafted traineddata file, causing denial of service. This issue is fixed in version 5.5.4.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
