VYPR
Unrated severityNVD Advisory· Published Jul 20, 2018· Updated Aug 5, 2024

CVE-2018-14436

CVE-2018-14436

Description

ImageMagick 7.0.8-4 has a memory leak in ReadMIFFImage when an exception occurs after colormap allocation, leading to potential denial of service via memory exhaustion.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

ImageMagick 7.0.8-4 has a memory leak in ReadMIFFImage when an exception occurs after colormap allocation, leading to potential denial of service via memory exhaustion.

Vulnerability

In ImageMagick 7.0.8-4, the ReadMIFFImage function in coders/miff.c contains a memory leak. When writing a colormap, memory is allocated via AcquireQuantumMemory. If an exception occurs (e.g., ImageDepthNotSupported), the allocated colormap memory is not freed, leading to a leak [1].

Exploitation

An attacker can trigger this leak by providing a crafted MIFF image that causes an error after colormap allocation, such as specifying an unsupported depth. The attacker only needs to supply the malicious image to an application using ImageMagick; no authentication or special privileges are required [1].

Impact

Repeated exploitation can lead to memory exhaustion, resulting in a denial of service. No other impact (e.g., code execution or data disclosure) is described [1].

Mitigation

The issue was reported but no specific fix version is provided in the reference. Users should upgrade to a version of ImageMagick later than 7.0.8-4, as the leak is likely addressed in subsequent releases. As a workaround, avoid processing untrusted MIFF images [1].

AI Insight generated on May 26, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

11

Patches

0

No patches discovered yet.

Vulnerability mechanics

Root cause

"Missing memory deallocation of the colormap buffer on an exception branch in ReadMIFFImage causes a memory leak."

Attack vector

An attacker provides a crafted MIFF image file that triggers the `ReadMIFFImage` code path in ImageMagick 7.0.8-4 [ref_id=1]. The image must have a colormap and a quantum depth value that falls into the `default` case of the depth switch statement, causing `ThrowWriterException` to be invoked [ref_id=1]. Because the colormap memory is allocated before the switch but freed only in the normal branches, the exception path leaks the allocated buffer [ref_id=1]. Repeatedly processing such crafted images can exhaust available memory, leading to a denial-of-service condition.

Affected code

The memory leak is in `ReadMIFFImage` in `coders/miff.c` [ref_id=1]. The allocation occurs at the colormap allocation block (around line 2420), where `AcquireQuantumMemory` is called for the colormap buffer [ref_id=1]. The `default` case in the `switch (quantum_info->depth)` statement throws an exception via `ThrowWriterException(CorruptImageError,"ImageDepthNotSupported")` without freeing the previously allocated colormap memory [ref_id=1].

What the fix does

The advisory does not include a patch diff, but the fix is implied by the bug report: the colormap memory must be freed before the `ThrowWriterException` call in the `default` branch of the depth switch [ref_id=1]. The reporter notes that the colormap is freed in the normal branch but "forgot free it in exception branch" [ref_id=1]. A proper fix would add a `colormap` deallocation (e.g., `colormap=(unsigned char *) RelinquishMagickMemory(colormap);`) immediately before each `ThrowWriterException` call that can be reached after the colormap allocation, or restructure the code to ensure cleanup occurs on all exit paths.

Preconditions

  • inputAttacker must supply a crafted MIFF image file that triggers the ReadMIFFImage code path
  • inputThe crafted image must have a colormap and a quantum depth value that falls into the default case of the depth switch statement

Generated on May 25, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

0

No linked articles in our index yet.