| Title | raysan5 raylib 6.2, 6.0 Memory Corruption |
|---|
| Description | Integer overflow in the atlas-size calculation of GenImageFontAtlas (src/rtext.c) in raylib leads to a heap out-of-bounds write. The atlas allocation size is computed as atlas.width * atlas.height using a 32-bit int. A crafted TrueType font inflates the estimated atlas dimensions until atlas.width and atlas.height reach 65536, so 65536 * 65536 wraps to 0. RL_CALLOC(0) returns an empty buffer, and because the pixel-copy loop validates the write index against the logical atlas.width / atlas.height (not the actual allocation size), it writes far past the 0-byte buffer.
This is NOT fixed by the patch for CVE-2025-15533 (commit 5a3391f): that fix added a bounds check on the write index, but it does not validate the allocation size, which is where this overflow occurs. The patch is present in the affected versions and the issue still reproduces; a separate fix (validating atlas.width * atlas.height in 64-bit before allocating) is required.
Reproduced on raylib master (commit 1825891) and release 6.2; the same unguarded code is present in 6.0. All of these postdate commit 909f040 and already contain the 5a3391f patch, so they fall outside the affected range of CVE-2025-15533.
The crash occurs during font atlas construction and is reachable through normal font loading via LoadFont / LoadFontEx at a large render size (fontSize 170 and above), because the space glyph U+0020 is in the default codepoint set. Under AddressSanitizer it presents as a SEGV in GenImageFontAtlas at src/rtext.c:912; a plain release build also crashes with SIGSEGV.
Root cause: CWE-190 (integer overflow) in GenImageFontAtlas. Consequence: CWE-787 (out-of-bounds write). Distinct from CVE-2025-15533 (CWE-122, write-index bounds) and CVE-2025-15534 (CWE-190 in a different function, LoadFontData).
Impact: memory corruption / denial of service from loading an untrusted font. A controlled write primitive is not demonstrated.
Reported by BlackChamber Labs. |
|---|
| Source | ⚠️ https://github.com/raysan5/raylib/issues/6406 |
|---|
| User | BlackChamber Labs (UID 102939) |
|---|
| Submission | 11/11/2026 21:30 (25 days ago) |
|---|
| Moderation | 12/06/2026 13:40 (25 days later) |
|---|
| Status | Accepted |
|---|
| VulDB entry | 450825 [raysan5 raylib 6.0/6.2 Font Atlas src/rtext.c GenImageFontAtlas integer overflow] |
|---|
| Points | 20 |
|---|