Skip to content

Commit

Permalink
sokol_app.h x11: fix UB in _sapp_x11_set_icon
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Jun 7, 2021
1 parent b3ffdf3 commit 8f39840
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -9677,10 +9677,10 @@ _SOKOL_PRIVATE void _sapp_x11_set_icon(const sapp_icon_desc* icon_desc, int num_
*dst++ = img_desc->height;
const int num_pixels = img_desc->width * img_desc->height;
for (int pixel_index = 0; pixel_index < num_pixels; pixel_index++) {
*dst++ = (src[pixel_index * 4 + 0] << 16) |
(src[pixel_index * 4 + 1] << 8) |
(src[pixel_index * 4 + 2] << 0) |
(src[pixel_index * 4 + 3] << 24);
*dst++ = ((long)(src[pixel_index * 4 + 0]) << 16) |
((long)(src[pixel_index * 4 + 1]) << 8) |
((long)(src[pixel_index * 4 + 2]) << 0) |
((long)(src[pixel_index * 4 + 3]) << 24);
}
}
XChangeProperty(_sapp.x11.display, _sapp.x11.window,
Expand Down

0 comments on commit 8f39840

Please sign in to comment.