Skip to content

Commit c67cbba

Browse files
committed
Fix UB in nitrogfx
1 parent 789fac3 commit c67cbba

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/nitrogfx/convert_png.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ void ReadPng(char *path, struct Image *image) {
109109
// Don't read the palette because it's not needed for now.
110110
image->hasPalette = (color_type & PNG_COLOR_MASK_COLOR) != 0;
111111
image->hasTransparency = color_type == PNG_COLOR_TYPE_PALETTE || ((color_type & PNG_COLOR_MASK_ALPHA) != 0);
112+
image->pixelsAreRGB = (color_type & PNG_COLOR_MASK_COLOR) != 0 && (color_type & PNG_COLOR_MASK_PALETTE) == 0;
112113

113114
image->width = png_get_image_width(png_ptr, info_ptr);
114115
image->height = png_get_image_height(png_ptr, info_ptr);

0 commit comments

Comments
 (0)