---
id: "CVE-2026-58496"
kind: "vulnerability"
aliases: ["CVE-2026-58496"]
title: "ThorVG: undersized font buffer causes out-of-bounds read on load"
severity: "medium"
cvss: 4.3
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["c++", "package", "thorvg", "vector-graphics"]
not_affected_if: ["file-path-font-loading", "thorvg-1.0.7-or-later", "trusted-fonts-only"]
published_at: "2026-10-27T23:17:06+00:00"
first_seen_at: "2026-10-27T23:29:44+00:00"
updated_at: "2026-10-27T23:31:22+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-58496", "first_seen_at": "2026-10-27T23:29:44+00:00"}]
---

# ThorVG: undersized font buffer causes out-of-bounds read on load

ThorVG's SFNT/TTF font loader reads the first four bytes of a font buffer without checking its length, so a font under four bytes read from memory triggers an out-of-bounds read. An attacker supplying a malformed short font can crash the application or leak adjacent heap memory.

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

## How to check

- Check the ThorVG version in use; affected if below `1.0.7`.
- Search the codebase for calls to `tvg::Text::load` or other memory-based font loading that accept untrusted font data.

## Fix

- Upgrade ThorVG to `1.0.7` or later.
- Until upgraded, validate that font buffers are at least four bytes before passing them to memory-based font loading.

## Timeline

- 2026-10-27T23:29:44+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-58496

## From the sources

Thor Vector Graphics (ThorVG) is a production-ready vector graphics engine. Prior to 1.0.7, the `SFNT/TTF` font loader's `SfntLoader::gen` function in `tvgSfntLoader.cpp` reads `data[0] through data[3]` to identify the font type without first checking that the input buffer contains at least four bytes. Loading an undersized font directly from memory through public APIs such as `tvg::Text::load` causes an out-of-bounds read. Loading through a file path using `mmap` can mask the read because of page alignment; the memory-loading API directly exposes it. Depending on memory layout, a malformed short font may crash the consuming application or disclose adjacent heap memory. This issue is fixed in version 1.0.7.

---

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