Skip to content

FPE errors when reading XWD images #1546

Closed
@hongxuchen

Description

@hongxuchen

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

When using identify -verbose $FILE on XWD files, it may emit FPE errors at multiple locations.

Steps to Reproduce

  • run identify -verbose $FILE
  • ASAN messages may be like:

fpe_xwd.c:490_1.xwd

ASAN:DEADLYSIGNAL
=================================================================
==19029==ERROR: AddressSanitizer: FPE on unknown address 0x7f0623a03210 (pc 0x7f0623a03210 bp 0x000000000000 sp 0x7ffc86dbd220 T0)
    #0 0x7f0623a0320f  (/usr/lib/x86_64-linux-gnu/libX11.so.6+0x2720f)
    #1 0x7f0627deb295 in ReadXWDImage coders/xwd.c:490
    #2 0x7f06276d4854 in ReadImage MagickCore/constitute.c:547
    #3 0x7f06276d778b in ReadImages MagickCore/constitute.c:917
    #4 0x7f0626f69817 in IdentifyImageCommand MagickWand/identify.c:321
    #5 0x7f0626ffdde0 in MagickCommandGenesis MagickWand/mogrify.c:184
    #6 0x55c1ef27bf00 in MagickMain utilities/magick.c:149
    #7 0x55c1ef27c186 in main utilities/magick.c:180
    #8 0x7f062675ab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #9 0x55c1ef27b979 in _start (/home/hongxu/work/imagemagick/ImageMagick-asan/install/bin/magick+0x1979)

fpe_xwd.c:520_1.xwd

ASAN:DEADLYSIGNAL
=================================================================
==28450==ERROR: AddressSanitizer: FPE on unknown address 0x7f20a562e210 (pc 0x7f20a562e210 bp 0x000000000000 sp 0x7ffd19f36b80 T0)
    #0 0x7f20a562e20f  (/usr/lib/x86_64-linux-gnu/libX11.so.6+0x2720f)
    #1 0x7f20a9a166c9 in ReadXWDImage coders/xwd.c:520
    #2 0x7f20a92ff854 in ReadImage MagickCore/constitute.c:547
    #3 0x7f20a930278b in ReadImages MagickCore/constitute.c:917
    #4 0x7f20a8b94817 in IdentifyImageCommand MagickWand/identify.c:321
    #5 0x7f20a8c28de0 in MagickCommandGenesis MagickWand/mogrify.c:184
    #6 0x55b4ed9adf00 in MagickMain utilities/magick.c:149
    #7 0x55b4ed9ae186 in main utilities/magick.c:180
    #8 0x7f20a8385b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #9 0x55b4ed9ad979 in _start (/home/hongxu/work/imagemagick/ImageMagick-asan/install/bin/magick+0x1979)

System Configuration

  • ImageMagick version:7.0.8-41 Q16 x86_64 2019-04-14
  • Environment (Operating system, version and so on): Ubuntu 18.04 LTS, x84_64
  • Additional information: This was firstly detected in GraphicsMagick, but I found this also happens in ImageMagick 6/7.

POCs:
im.zip

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