Skip to content

Division by zero in XFontBrowserWidget() of MagickCore/widget.c #3335

@wuruoyu

Description

@wuruoyu

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

Similar to #3333, a division-by-zero exception can happen in function XFontBrowserWidget() at line 5735 when windows->widget.font_info->ascent = 0 and windows->widget.font_info->descent = 0.
Below is the code that the division-by-zero exception can happen.

visible_fonts=scroll_info.height/(height+(height >> 3));

height is defined in the code below:

height=(unsigned int) (font_info->ascent+font_info->descent);

windows->widget.font_info->ascent and windows->widget.font_info->descent are controller by the user since XFontBrowserWidget() is an API function, and there is no sanity check in between.

Thank you in advance! Let me know if you have any questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions