vincentg / hsmagick

Haskell FFI bindings to ImageMagick
Other
18 stars 4 forks source link

x86_64 segmentation fault #7

Open hoko-zz opened 11 years ago

hoko-zz commented 11 years ago

There is a suspicious code in FFIHelpers.hsc:

instance Storable ExceptionInfo where
  sizeOf _    = 32 -- TODO
  alignment _ = alignment (undefined::CULong)

Also Images.hsc: setImageColormap / newImageColormap have Word32 as first arg, while /usr/include/GraphicsMagick/wand/magick_wand.h specifies const unsigned long.

// At least after changing it to #size ExceptionInfo and CULong hello-world (like png->gif) works on my amd64 box.

jonkri commented 9 years ago

Thanks for reporting this issue.

I ran into a segmentation fault too with the following code:

import Graphics.Transform.Magick.Images
import Graphics.Transform.Magick.Types

main = do
    initializeMagick
    image <- readImage "input.png"
    writeImage "output.png" (resizeImage 50 50 PointFilter 1 image)

Changing "32" to "64" in FFIHelpers :315 allowed me to resize the image.