Skip to content

Division by Zero at MagickCore/colorspace-private.h #1711

@SuhwanSong

Description

@SuhwanSong

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

There are 3 division by zero at MagickCore/colorspace-private.h and outside the range bug at MagickCore/quantum.h:120.

Steps to Reproduce

poc.zip

please run a following cmd with poc file.
magick $PoC -resize 1023 -render -bordercolor "rgb(46,232,244)" tmp.cmyka

Here's UBSAN log.

MagickCore/colorspace-private.h:78:38: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior MagickCore/colorspace-private.h:78:38 in 
MagickCore/colorspace-private.h:79:44: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior MagickCore/colorspace-private.h:79:44 in 
MagickCore/colorspace-private.h:80:42: runtime error: division by zero
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior MagickCore/colorspace-private.h:80:42 in 
MagickCore/quantum.h:120:10: runtime error: -nan is outside the range of representable values of type 'unsigned char'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior MagickCore/quantum.h:120:10 in

System Configuration

  • ImageMagick version:
    Version: ImageMagick 7.0.8-68 Q16 x86_64 2019-10-02 https://imagemagick.org

  • Environment (Operating system, version and so on):
    Description: Ubuntu 18.04.1 LTS
    Release: 18.04
    Codename: bionic

  • Additional information:
    CC=clang-6 CXX=clang++6 CFLAGS="-fsanitize=address,undefined -g" CXXFLAGS="-fsanitize=address,undefined -g" ./configure --disable-openmp

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions