rgbds: Crash when converting image with alpha channel
When converting this image with a palette rgbgfx
crashes:
rgbgfx -c “#FFFFFF,#cfcfcf,#686868,#000000;” ball.png -o ball.2bpp
rgbgfx: /build/rgbds/src/rgbds/src/gfx/process.cpp:662: static uint16_t TileData::rowBitplanes(const Png::TilesVisitor::Tile&, const Palette&, uint32_t): Assertion `index < palette.size()’ failed.
This doesn’t happen when the image has no alpha values and when no palette is specified.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (12 by maintainers)
Well, the original report had that ball.png which was non-indexed, but it also works with an indexed file:
Thank you for reporting the issue!
I have had a similar bug report via IM, though @datguywitha3ds didn’t have assertions enabled so it instead misbehaved a lot. (So there is at least another reproducer; I don’t have it at hand, can Valentina attach it, please?)
I’m guessing the issue is that the presence of an alpha channel reduces the palette size to 3, but this is not taken into account when validating the palette spec. (Though I don’t think Valen used
-c
, so the issue may lie deeper.)