bootchk / resynthesizer

Suite of gimp plugins for texture synthesis
GNU General Public License v3.0
1.47k stars 163 forks source link

fill with pattern seamless crashes on clipboad in other precision modes #99

Open marcespie opened 3 years ago

marcespie commented 3 years ago

Quite reproducible:

I've trace it down to

2 0x0000042f6147e7da in gimp_pattern_select_button_callback (

pattern_name=0x42ef5a54650 "Clipboard Image", width=113, height=88, 
bytes=16, 
mask_data=0x42f76174000 "2\005\b\377\070\v\020\377\065\b\r\377\065\n\021\377\066\v\022\377\067\f\023\377\067\f\023\377\067\n\021\377\066\t\020\377\066\a\017\377\067\b\020\377;\t\022\377<\n\023\377?\f\025\377@\r\026\377?\f\025\377>\v\024\377@\v\025\377@\v\025\377C\v\024\377C\v\024\377B\n\025\377@\b\023\377@\b\023\377@\b\023\377@\b\023\377@\b\023\377?\a\022\377>\006\021\377>\006\023\377@\b\025\377C\v\030\377F\016\033\377G\017\034\377G\017\034\377E\r\032\377A\t\026\377=\005\022\377=\005\022\377@\b\023\377C\v\026\377C\v\026\377B\n\025\377A\t\026\377B\n\027\377B\t\030\377@\a\026\377>\005\026\377>\005\026\377?\006\031\377"..., 
dialog_closing=0, user_data=0x42ef5a160e0) at gimppatternselectbutton.c:438

438 priv->mask_data = g_memdup (mask_data, width height bytes);

but no further... hinting that the size would be wrong. (width=113, height=88,bytes=16 in my case... it's on a picture with an alpha channel. where 16 sounds right.

seems to crash at various places when not in 8 bit integer...

bootchk commented 3 years ago

Yes. The Resynthesizer only understands RGBA 8 bit.

At a minimum, I should document that fact.

Then the plugin should preflight that given images are in that precision, and not crash.

Then possibly it should convert precisions. I don't know enough about the subject of colorspaces to know what might be lost. I have briefly thought about whether the algorithm would work better in another colorspace anyway, i.e. always convert to HSV and the algorithm works in that space. I may not be using the right terminology, that's my ignorance of the subject.

I suspect there are plenty of plugins in the same situation. Plugins dating from the days when RGBA 8 bit was good enough. AFAIK it still is good enough for the vast majority of users. I would summarize the big picture as: a few graphics professionals have pushed GIMP development in the direction of their needs, and plugins have not kept up with the changes to GIMP. Its not a new situation, when I first got involved with the Resynthesizer, it was because it had not kept up with changes to GIMP.

marcespie commented 3 years ago

Ah but that's not actually true! I don't know if it's just a happy accident, but for instance "healing selection" has zero issues with 32 bit floating point mode.

It only seems to cause a crash with the clipboard itself being a non-standard mode, and using "feel with pattern seamless".

there's probably a test/parameter missing somewhere, but it's not as bad as you think.

bootchk commented 3 years ago

Thanks. Oops, I am not reading carefully enough.

Your original statement seems to say that the plugin crashed in gimp_pattern_select_button_callback(), which is part of libgimp, not code of the plugin. So maybe there is a bug there. I will first search GIMP issues for a prior report of an issue with Pattern select, and then try to reproduce it to get a full stack trace to see exactly where and why it crashes.