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

hist_find_ndim crashes on images with an alpha channel #2634

Closed
travisbell opened this issue Jan 27, 2022 · 3 comments
Closed

hist_find_ndim crashes on images with an alpha channel #2634

travisbell opened this issue Jan 27, 2022 · 3 comments
Labels

Comments

@travisbell
Copy link

travisbell commented Jan 27, 2022

Hi John, I've been working on migrating IM workflows over to vips and everything has been going very smoothly, thanks so much for your hard work and dedication.

One issue I have stumbled on is that when trying to use hist_find_ndim, vips is crashing on images with transparency. On Mac OS, I get:

$ vips hist_find_ndim tmp/test2.png tmp/test2_histogram.png
Abort trap: 6

And on Linux, I get:

vips hist_find_ndim tmp/test2.png tmp/test2_histogram.png
*** stack smashing detected ***: terminated
Aborted

This is on the latest build:

vips -v
vips-8.12.2-Tue Jan 25 09:34:32 UTC 2022

Is there something I need to do different with hist_find_ndim for these images? I couldn't find anyone else talking about this...

@travisbell travisbell added the bug label Jan 27, 2022
@jcupitt
Copy link
Member

jcupitt commented Jan 27, 2022

Hi @travisbell,

You're right, it doesn't check that bands <= 3, I'll change it.

As a workaround, you can take just the first three bands like this:

vips extract_band rgba.png rgb.png 0 --n 3
vips hist_find_ndim rgb.png histogram.png

Thanks for pointing out this dumbness.

@travisbell
Copy link
Author

As a workaround, you can take just the first three bands like this:

vips extract_band rgba.png rgb.png 0 --n 3
vips hist_find_ndim rgb.png histogram.png

Perfect, this is working properly now.

Thanks for pointing out this dumbness.

I choose to believe just an oversight and not dumbness! 😉

jcupitt added a commit that referenced this issue Jan 28, 2022
we were not checking the number of input bands

move checks to _build

thanks travisbell

see #2634
@jcupitt
Copy link
Member

jcupitt commented Jan 28, 2022

OK, fixed for 8.12.3, I credited you, I hope that's OK.

@jcupitt jcupitt closed this as completed Jan 28, 2022
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

2 participants