Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic occurs in the GetImageBlob function #308

Closed
SpacemanZoey opened this issue Apr 2, 2024 · 3 comments
Closed

panic occurs in the GetImageBlob function #308

SpacemanZoey opened this issue Apr 2, 2024 · 3 comments

Comments

@SpacemanZoey
Copy link

I'm using gopkg.in/gographics/imagick.v2 v2.6.3 to convert pdf to jpg. In line "ret := C.GoBytes(unsafe.Pointer(csblob), C.int(clen))", it reports a panic. Is there anything to check csblob or clen is valid, or how to fix it
image

@justinfx
Copy link
Member

justinfx commented Apr 2, 2024

Do you happen to have a reproduction that you could provide?

It may be the case that we need to check Getlasterror before we try and use the results.

You could also set the env var MAGICK_DEBUG to either Trace or Blob to see if it reports the underlying problem.

https://imagemagick.org/script/command-line-options.php#debug

@justinfx
Copy link
Member

justinfx commented Apr 3, 2024

I was able to fix it by adding a check for C API ImageMagick errors, before calling our conversions.

@justinfx
Copy link
Member

justinfx commented Apr 3, 2024

Tagged v2.6.4 and v3.5.3

@justinfx justinfx closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants