Last active
December 17, 2025 06:49
-
-
Save 1mxml/cabd6d972557d9d992fe5f4f6ca1dd87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
Hello @1mxml!
Have you reported that to upstream?
FWIW, there was as well in past (and yet unfixed): https://sourceforge.net/p/freeimage/bugs/366/ (CVE-2024-28565).
I have asked in https://sourceforge.net/p/freeimage/bugs/390/
Thanks @carnil!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Heap Buffer Overflow DoS Vulnerability in FreeImage (
psdParser::ReadImageData)CVE-ID: CVE-2025-65803
Affected Component:
psdParser::ReadImageDataAffected Product: FreeImage ≤ 3.18.0
Impact: Denial of Service (DoS), potential memory corruption
Overview
A crafted PSD file can trigger a heap-buffer-overflow in FreeImage during image parsing.
The issue exists in
psdParser::ReadImageData, where the parser computes the number of bytes per row (lineSize) directly from PSD header values without verifying whether thedepthfield is valid.When an attacker provides an abnormally large
depth, the computedlineSizebecomes extremely large. This value is subsequently used in amemcpy()operation, overflowing the destination bitmap row buffer and causing a crash.Technical Description
PSD header fields such as
depth,width, andchannelsare used to calculate:bytes = depth / 8
lineSize = width * bytes
FreeImage allocates a normal-sized bitmap row buffer based on expected bit-depth (e.g., ~80 bytes).
However, with a malicious PSD header,
lineSizecan reach tens of kilobytes.The parser then performs:
memcpy(dst_line_start, src, lineSize)
Trigger Conditions
depthfieldnCompression = NONE, causing the parser to copy raw pixel data using the inflatedlineSizeFreeImage_Load()Any application using FreeImage to open PSD files is impacted.
Mitigation Recommendations
depthvalues (allow only expected values such as 1, 8, 16)lineSizedoes not exceed the size of the destination row buffer