CVE-2026-40494
Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.
NVD · uneditedSAIL 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.
Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.
dbcve analysis · high confidenceThe TGA codec's RLE decoder in tga.c has an asymmetric bounds check vulnerability where the run-packet path correctly clamps the repeat count to remaining buffer space, but the raw-packet path (lines 305-311) lacks equivalent bounds checking. This allows writing up to 496 bytes of attacker-controlled data past the end of a heap buffer, resulting in a heap buffer overflow.
Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.
CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.
From the vector- Attack vector
- Network
- Complexity
- Low
- Privileges
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.
dbcve checksWork through these to decide whether this CVE applies to you.
-
Identify SAIL library installationSearch for SAIL library files (libsail.so, sail.h, or related binaries) in the system or within the application's dependenciesAffected if SAIL library is present in the environment
-
Determine SAIL library versionRun commands such as 'pkg-config --modversion sail' or check the library file metadata (ldd, file version info) to obtain the SAIL versionAffected if The installed version is older than the patched version containing commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302
-
Locate tga.c source fileFind the tga.c file within the SAIL library source code or the application's codebaseAffected if The tga.c file exists and contains the RLE decoder implementation
-
Inspect raw-packet bounds checkExamine lines 305-311 in tga.c and verify whether bounds checking (buffer length validation) is performed before writing raw packet data to the bufferAffected if The raw-packet path (lines 305-311) lacks buffer length validation before writing data, allowing writes beyond buffer boundaries
-
Confirm TGA image processingReview application logs, code, or runtime behavior to determine if TGA format images are being decoded using the SAIL libraryAffected if The application processes TGA images using the vulnerable RLE decoder in tga.c
A user is affected if they use a version of the SAIL library prior to the fix commit and process TGA images with the library's RLE decoder, allowing heap buffer overflow via the unchecked raw-packet path.
Generated from the published advisory. Verify against your own configuration.
Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.
dbcve · scopedUpdate SAIL library to include commit 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302 which adds proper bounds checking to the raw-packet path in tga.c, or apply the patch to add equivalent buffer length validation before writing raw packet data.
- 1. Locate the TGA codec source file (tga.c) in the SAIL library codebase
- 2. Navigate to the RLE decoder function, specifically around lines 297-311
- 3. Review the run-packet path at line 297 which correctly clamps the repeat count to remaining buffer space
- 4. Add equivalent bounds checking to the raw-packet path (lines 305-311) to prevent writing past the end of the heap buffer
- 5. The fix should ensure that raw packet size does not exceed remaining buffer space before performing the memcpy operation
- 6. Apply the bounds check logic similar to the run-packet path: clamp the packet size to the remaining buffer capacity
- 7. Rebuild the library after applying the patch
- 8. Test the TGA codec with crafted RLE-compressed TGA images to verify the vulnerability is resolved
Generated from the published advisory — verify against the referenced sources before acting.
- Consultation2.0 h
- Implementation4.0 h
- Testing6.0 h
- Review / QA3.0 h
An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $4,096.
Scan for this in your stack
Free · runs locallyCheck whether your project pulls in CVE-2026-40494 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.
References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.
Primary sourcesPractitioner notes
ContributedPeer-ranked notes from engineers who’ve handled CVE-2026-40494 in production — separate from our analysis above.
The advisory tells you what broke. It rarely tells you what actually worked. If you’ve dealt with this one, that detail is what the next engineer is searching for.
- The version that genuinely resolved it — not the one the vendor claimed
- A config change or rule that shut the vector down
- A gotcha in the upgrade path that cost you an afternoon
No notes yet
Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.
A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.
- Verified mitigations, workarounds, and config changes
- Version or environment caveats, and links to real fixes
- No weaponised exploit code, or anything meant to cause harm
- No spam, self-promotion, credentials, or personal data