Description
SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302, the TGA codec's RLE decoder in `tga.c` has an asymmetric bounds check vulnerability. The run-packet path (line 297) correctly clamps the repeat count to the remaining buffer space, but the raw-packet path (line 305-311) has no equivalent bounds check. This allows writing up to 496 bytes of attacker-controlled data past the end of a heap buffer. Commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302 patches the issue.
Published: 2026-04-18
Score: 9.8 Critical
EPSS: < 1% Very Low
KEV: No
Impact: Heap buffer overflow enabling arbitrary code execution
Action: Immediate Patch
AI Analysis

Impact

The SAIL image library contains a heap buffer overflow in its TGA RLE decoder. The raw‑packet path on lines 305‑311 lacks the bounds check that the run‑packet path includes, allowing up to 496 bytes of attacker‑controlled data to be written beyond the end of a heap buffer. This can overwrite neighboring memory and lead to arbitrary code execution or other memory corruption effects, classifying the flaw as a classic buffer overflow (CWE‑787).

Affected Systems

Any installation of the HappySeaFox SAIL library that has not incorporated commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302 or later. The issue exists across all platforms supported by SAIL because the vulnerable code resides in the core tga.c file. Applications that rely on the TGA format for loading images are affected if they use a pre‑patch version of the library.

Risk and Exploitability

The vulnerability carries a CVSS score of 9.8, placing it in the critical range, and its EPSS score is not available, leaving the exploitation probability uncertain. The flaw is not listed in CISA’s KEV catalog. Attackers can exploit it by supplying a specially crafted TGA file to any process that loads images through SAIL; the uncontrolled write occurs on the stack or heap of the process, so local code execution or privilege escalation is possible if the application runs with elevated rights. Because the vulnerability is file‑based, the attack surface extends to any user or remote attacker who can influence image input. No public exploits are currently documented, but the high severity and absence of mitigations in many deployments warrant immediate remediation.

Generated by OpenCVE AI on April 18, 2026 at 08:39 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the SAIL library to a build that includes commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302 or later.
  • If upgrading the library is not immediately possible, replace the tga.c file with the patched version from the commit and rebuild the application.
  • In the meantime, disable TGA image support or perform strict validation of all TGA files before passing them to SAIL to reduce the window of opportunity for an attacker.

Generated by OpenCVE AI on April 18, 2026 at 08:39 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sat, 18 Apr 2026 03:45:00 +0000

Type Values Removed Values Added
First Time appeared Happyseafox
Happyseafox sail
Vendors & Products Happyseafox
Happyseafox sail

Sat, 18 Apr 2026 02:30:00 +0000

Type Values Removed Values Added
Description SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302, the TGA codec's RLE decoder in `tga.c` has an asymmetric bounds check vulnerability. The run-packet path (line 297) correctly clamps the repeat count to the remaining buffer space, but the raw-packet path (line 305-311) has no equivalent bounds check. This allows writing up to 496 bytes of attacker-controlled data past the end of a heap buffer. Commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302 patches the issue.
Title SAIL has heap buffer overflow in TGA RLE decoder — raw packet path missing bounds check
Weaknesses CWE-787
References
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}


Subscriptions

Happyseafox Sail
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-04-18T01:42:48.830Z

Reserved: 2026-04-13T19:50:42.115Z

Link: CVE-2026-40494

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-04-18T03:16:13.590

Modified: 2026-04-18T03:16:13.590

Link: CVE-2026-40494

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-04-18T08:45:41Z

Weaknesses