The vulnerability exists in the distributed pixel cache server component of ImageMagick. When handling incoming network requests to write pixel data, specifically metacontent and pixel data, the server reads a data length from the network stream. This length value was not validated against the size of the destination buffer on the heap. An attacker could provide a malicious length value, larger than the buffer, causing a heap buffer overflow when the server attempts to copy the pixel data. The patch introduces a size validation, calculating the expected maximum size (extent) and comparing it with the received length. The vulnerable functions, WriteDistributeCacheMetacontent and WriteDistributeCachePixels in MagickCore/distribute-cache.c, were patched to include this check, mitigating the vulnerability.