Skip to content

RGBGFX segfault #1651

Closed
Closed
@Rangi42

Description

@Rangi42

Discord report: https://discord.com/channels/303217943234215948/870005582042628196/1336507100620132382

segfault.png

The gist of it seems to be that embedded palettes are not read properly, and an image with an embedded palette that uses color #0 on any pixel causes the code that displays a palette to segfault. Here's the output for rgbgfx -o segfault.2bpp -c embedded segfault.png:

error: Failed to fit tile colors [$1527, $15cc, $1ab4] in specified palettes
note: The following palette was specified:
Segmentation fault (core dumped)

If I modify the image to not use color #0 from the embedded palette, I get a similar failure but with no segfault, so the code successfully prints... no palette:

error: Failed to fit tile colors [$1527, $15cc, $1ab4] in specified palettes
note: The following palette was specified:
        []
Conversion aborted after 1 error

Note that GItHub re-encodes the image, so:

% xxd segfault.png 
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
00000010: 0000 0060 0000 0008 0803 0000 0031 e10a  ...`.........1..
00000020: 3d00 0000 0173 5247 4200 aece 1ce9 0000  =....sRGB.......
00000030: 000c 504c 5445 6ce0 40a0 a830 6070 2838  ..PLTEl.@..0`p(8
00000040: 4828 279c d804 0000 0004 7452 4e53 00ff  H('.......tRNS..
00000050: ffff b32d 4088 0000 008f 4944 4154 2891  ...-@.....IDAT(.
00000060: b552 5b12 c420 0833 e4fe 77de 8108 52b5  .R[.. .3..w...R.
00000070: d3af 85b6 60a2 3c2a 63b8 189f 6237 70e3  ....`.<*c...b7p.
00000080: dfe8 38ab f3e5 0e02 6028 4002 0c1e 5a27  ..8.....`(@...Z'
00000090: b6f1 0b6f d6b5 8a93 3b93 f91e 7dfc 5100  ...o....;...}.Q.
000000a0: 0a93 b2d9 e44f 3c13 28ce ea40 0066 82ac  .....O<.(..@.f..
000000b0: 905e 25ab 0bbd 8d9f c574 eb4e c47b 3690  .^%......t.N.{6.
000000c0: 19e7 4ee2 e8a0 7b8b dff5 ab03 5695 5677  ..N...{.....V.Vw
000000d0: 907a f26d 9dff 7fbc dec1 3612 761d adcf  .z.m......6.v...
000000e0: 21b3 c0ae 53f4 47f9 0125 ba04 bca2 595c  !...S.G..%....Y\
000000f0: eb00 0000 0e65 5849 664d 4d00 2a00 0000  .....eXIfMM.*...
00000100: 0800 0000 0000 0000 d253 9300 0000 0049  .........S.....I
00000110: 454e 44ae 4260 82                        END.B`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected behavior / crashes; to be fixed ASAP!rgbgfxThis affects RGBGFX

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions