{"id":"CVE-2026-40494","published":"2026-04-18T01:42:48Z","modified":"2026-04-20T14:55:42Z","title":"SAIL has heap buffer overflow in TGA RLE decoder — raw packet path missing bounds check","vendor":"HappySeaFox","product":"sail","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":9.8,"severity":"CRITICAL","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00338,"percentile":0.27935,"provenance":"source"},"cwes":[{"id":"CWE-787","name":"Out-of-bounds Write"}],"references":[{"url":"https://github.com/HappySeaFox/sail/security/advisories/GHSA-cp2j-rwh4-r46f","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/HappySeaFox/sail/commit/45d48d1f2e8e0d73e80bc1fd5310cb57f4547302","tags":["x_refsource_MISC"]}],"priority":{"score":12.4,"factors":[{"name":"EPSS percentile","points":5.59},{"name":"CVSS severity","points":6.86}]},"vendorSlug":"happyseafox","affectedVersions":[{"vendor":"HappySeaFox","product":"sail","versions":["< 45d48d1f2e8e0d73e80bc1fd5310cb57f4547302"]}],"ssvc":{"exploitation":"poc","automatable":"yes","technicalImpact":"total","timestamp":"2026-04-20T14:47:38.934644Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2026-23648","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-happyseafox-sail-cve-2026-40494","children":[{"from":"CVE-2026-40494","to":"CVE-2026-54626","relation":"incomplete-fix","confidence":"high","kind":"lineage","evidence":[{"kind":"text","provenance":"source","relation":"incomplete-fix","quote":"The pixel-count clamp added for CVE-2026-40494 does not constrain the per-pixel write width, so this issue is an incomplete fix of that vulnerability and can cause heap corruption, a reliable crash, or potential code execution.","from":"CVE.org","in":"CVE-2026-54626"},{"kind":"same-code","provenance":"machine","files":["src/sail-codecs/tga/tga.c"],"commits":["https://github.com/HappySeaFox/sail/commit/45d48d1f2e8e0d73e80bc1fd5310cb57f4547302","https://github.com/HappySeaFox/sail/commit/fa24bceb93958ad665dbc3cf6b49a1079ab12559"],"basis":"shared function","functions":["sail_"]}]}]}}