commonsmachinery / blockhash

blockhash.io
MIT License
86 stars 28 forks source link

animated gif #25

Closed patatetom closed 6 years ago

patatetom commented 6 years ago

hello,

during an automatic image processing, I came across this animated GIF image that completely freezes my computer when blockhash tries to calculate its checksum.

the problem does not occur with the Python version.

regards, lacsaP.

pdf-ownership-variant1-2x.gif.gz (this image ~900ko is provided by Adobe for Acrobat Reader)

artfwo commented 6 years ago

@patatetom I cannot reproduce this. This gif image has errors and ImageMagick fails to open it with an error (and Python image library probably just ignores the errors). The error is properly caught in blockhash too. I get the following output when running blockhash with this image:

./blockhash pdf-ownership-variant1-2x.gif 
Error opening image file pdf-ownership-variant1-2x.gif

What version if ImageMagick libraries have you got installed?

patatetom commented 6 years ago

hi again Artem,

I now think it's a problem with ImageMagick 6.9.9-3, because when I try to open the gif with the display tool of the suite, my computer (vm) freezes immediately.

on another computer, display in version 7.0.7-21 hardly opens the image but does not fall. I'll check blockhash on this system : if no feedback from me, it's because the problem was related to ImageMagick as you suggested.

thanks for the trail, lacsaP.

patatetom commented 6 years ago

no errors for blockhash with ImageMagick 7.0.7-21 :

blockhash-master $ ./waf configure
Setting top to                           : /tmp/blockhash-master 
Setting out to                           : /tmp/blockhash-master/build 
Checking for 'gcc' (c compiler)          : /usr/bin/gcc 
Checking for library m                   : yes 
Checking for program pkg-config          : /usr/bin/pkg-config 
Checking for 'MagickWand'                : yes 
Checking for 'MagickWand' version        : yes 
'configure' finished successfully (0.196s)

blockhash-master $ ./waf 
Waf: Entering directory `/tmp/blockhash-master/build'
[1/2] c: blockhash.c -> build/blockhash.c.1.o
[2/2] cprogram: build/blockhash.c.1.o -> build/blockhash
Waf: Leaving directory `/tmp/blockhash-master/build'
'build' finished successfully (0.263s)

blockhash-master $ ldd build/blockhash
    linux-vdso.so.1 (0x00007ffd60d80000)
    libMagickWand-7.Q16HDRI.so.5 => /usr/lib/libMagickWand-7.Q16HDRI.so.5 (0x00007f99aa973000)
    libMagickCore-7.Q16HDRI.so.5 => /usr/lib/libMagickCore-7.Q16HDRI.so.5 (0x00007f99aa48d000)
    ...

blockhash-master $ ./build/blockhash /tmp/pdf-ownership-variant1-2x.gif
0000aaaaffff7fff0000ffffffffffff0000aaaaffffffff0000fefefefede00  /tmp/pdf-ownership-variant1-2x.gif

but this image still causes problems (freeze) for ImageMagick when, for example, I try to extract all frames from it with the command convert -coalesce /tmp/pdf-ownership-variant1-2x.gif /tmp/out%05d.gif (but it's ok if I remove option).

blockhash-master $ convert --version
Version: ImageMagick 7.0.7-21 Q16 x86_64 2018-01-07 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib