C++Severity: HighStatus: Published

TGA RLE decoder stack buffer overflow via unchecked pixelDepth

When axmol loads a TGA image, the RLE decoder takes pixelDepth from the file header and copies that many bytes into a 4-byte stack buffer, so a file with pixelDepth greater than 32 can write past the buffer (CWE-121, CWE-787). The advisory lists affected versions as <= latest and lists no patched version. GitHub rates it high, with CVSS 3.1 score 7.8. There is no CVE. The code fix removes TGAlib in pull request 3439, merged to dev, and pull request 3440, merged to release/2.x. The fix is on dev and is not yet in a release. The latest release is still v2.11.5. The advisory credits Ugur Celik (ucsurf).

Impact

When axmol loads a TGA image, tgaLoadRLEImageData in axmol/base/TGAlib.cpp sets the bytes per pixel from pixelDepth in the file header and does not limit that value. Each decoded pixel is copied into a 4-byte stack buffer. pixelDepth is an unsigned char, so the copy length can be larger than 4. A TGA whose pixel depth is greater than 32 can write past that buffer (CWE-121, CWE-787).

The image loader can reach this path when it opens a TGA, including from Image and from TileMapAtlas.

Affected versions and fix

The advisory lists affected versions as <= latest. It lists no patched version. There is no release after v2.11.5.

The code fix removes TGAlib and decodes TGA with stb_image. Pull request 3439, merged as ee7f598 on 2026-11-25, lands that change on dev. Pull request 3440 lands the same removal on release/2.x. The fix is on dev and is not yet in a release. The latest release is still v2.11.5.

The published advisory is GHSA-9w6v-gqfh-3768. GitHub rates it high, with CVSS 3.1 score 7.8 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H). There is no CVE. halx99 published the advisory. The advisory credits Ugur Celik (ucsurf).

Timeline

  1. Found
  2. Advisory published
  3. Entry last updated

Machine-readable: JSON · Markdown · ID security/cpp/axmolengine__axmol/2026-11-29-tga-rle-unchecked-pixeldepth-stack-overflow

If this work is useful to you, you can support it on Buy Me a Coffee.