Closed kornelski closed 8 months ago
Thank you, these changes look sensible. Do you have any clue on why len
can be outside of the expected range in the affected code?
I only have a core dump without the image, so I don't know exactly.
A common tricky case that may be related is pixels having higher values than palette length.
It also could have been 1x1 interlaced image.
Thanks for this @kornelski. I'll take a closer look later and try to figure out what would actually cause this, but I'm surprised it can happen since:
I managed to reproduce a crash at that point. @kornelski was right - it can happen when palette entries are missing.
The reduced_palette
is supposed to fix any such issues, but it won't if the palette was one entry too short. I'll make up a separate PR with a test case to fix this.
I've seen a panic in
most_popular_edge_color
, so I've made it more resilient.