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

FFI::NullPointerError: when reading the smallest GIF #349

Open
Nakilon opened this issue Nov 11, 2022 · 3 comments
Open

FFI::NullPointerError: when reading the smallest GIF #349

Nakilon opened this issue Nov 11, 2022 · 3 comments
Labels

Comments

@Nakilon
Copy link
Contributor

Nakilon commented Nov 11, 2022

Vips::Image.new_from_buffer("GIF89a\x01\x00\x01\x00\x00\xff\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x00;", "").to_enum
FFI::NullPointerError: invalid memory read at address=0x0000000000000000

MacOS, ruby 2.3.8, ruby-vips-2.1.4, vips-8.11.3

I suppose I took it from here http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever

@Nakilon Nakilon added the bug label Nov 11, 2022
@jcupitt
Copy link
Member

jcupitt commented Nov 11, 2022

Hi @Nakilon,

Ouch, that's bad, thanks for the report. It seems to be fixed in master and in 8.13:

$ irb                                    
irb(main):001:0> require 'vips'
=> true
irb(main):002:0> Vips::Image.new_from_buffer("GIF89a\x01\x00\x01\x00\x00\xff\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x00;", "")
=> #<Image 1x1 uchar, 3 bands, srgb>
irb(main):003:0> 

@Nakilon
Copy link
Contributor Author

Nakilon commented Nov 11, 2022

Oh, good to know. Indeed I see lots of recent GIF-related commits. Fine then.
I used a bit larger file from the same article for my unit test for now.

@kleisauke
Copy link
Member

Ah, I remembered having seeing this before with the old giflib-based loader, see e.g. libvips/libvips#773.

I think(?) commit netsurf-browser/libnsgif@41f33c7 fixed this. This was landed in libvips with commit libvips/libvips@8c9d899.

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

No branches or pull requests

3 participants