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

Segmentation fault #156

Closed
dirceu-jr opened this issue Feb 28, 2018 · 4 comments
Closed

Segmentation fault #156

dirceu-jr opened this issue Feb 28, 2018 · 4 comments

Comments

@dirceu-jr
Copy link

dirceu-jr commented Feb 28, 2018

Hello,
I'm on MacOS. I'm getting segmentation fault after I use .to_a in a Vips::Image object. But it's not on a simple Vips::Image.

In fact .to_a to a RGB Vips::Image works.
But I get the segmentation fault when I do something like:

image = Vips::Image.new_from_file("tiny_or_big_image.png")
r, g, b, a = image.bandsplit
l = r / g
p l.to_a # it prints
p l.min # it prints
l *= 255
p l.min # do not print, segmentation fault here

.rvm/gems/ruby-2.5.0/gems/ruby-vips-2.0.9/lib/vips/operation.rb:72: [BUG] Segmentation fault at 0x0000000000000000
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
-- Control frame information -----------------------------------------------
c:0009 p:---- s:0070 e:000069 CFUNC :vips_cache_operation_build

my libvips is 8.6.2 via homebrew

It does not matter if its a tiny of big image file.

I will not need to use l.min in production, but it is helping me to figure out something about my usage of libvips.

@jcupitt
Copy link
Member

jcupitt commented Mar 1, 2018

Hello, I agree, I see a crash here with this test program:

#!/usr/bin/env ruby

require 'vips'

l = Vips::Image.black 10, 10
l += 2
x = l.write_to_memory
y = l.write_to_memory

I'll investigate.

Thank you for the report!

@jcupitt jcupitt added the bug label Mar 1, 2018
jcupitt added a commit to libvips/libvips that referenced this issue Mar 4, 2018
two writes in a row could trigger a crash in some circumstances, thanks
@dirceupj

see libvips/ruby-vips#156
@jcupitt
Copy link
Member

jcupitt commented Mar 4, 2018

I think I've found a nice fix -- would you be able to test HEAD of the 8.6 branch of libvips?

@dirceu-jr
Copy link
Author

@jcupitt Tested with HEAD of 8.6 (8.6.3). Works fine. Thank you.

$vips --version
vips-8.6.3-Sun Mar  4 22:50:55 UTC 2018

I could properly execute the provided script in Issue first comment without segmentation fault occurrence.

@jcupitt
Copy link
Member

jcupitt commented Mar 5, 2018

That's great, thanks!

I'll push out 8.6.3 in a day or so with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants