The vulnerability is a heap buffer overwrite caused by an integer overflow when calculating the memory size for a morphology kernel. The patch introduces a new function, AcquireKernelValues, which performs a sanity check (HeapOverflowSanityCheckGetSize) before allocating memory. The vulnerable functions, ParseKernelArray, AcquireKernelBuiltIn, and CloneKernelInfo, were all modified to use this new safe allocation function, indicating that they were previously performing unsafe memory allocations. An attacker could exploit this by providing a specially crafted kernel string or by using a built-in kernel that results in large width and height values, causing an integer overflow and leading to a small allocation with a subsequent buffer overflow when the kernel data is written.