aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2021-06-07 19:44:26 +0200
committerAndre Weissflog <floooh@gmail.com>2021-06-07 19:44:26 +0200
commit8f39840687d2675c199c6b34d6b3c64ba4a8786b (patch)
tree10b278ea84c9c818c22c83c4f1a01e6f1723a8d8
parentb3ffdf3e561fe157fa8a03f08e49d0278c3624fd (diff)
sokol_app.h x11: fix UB in _sapp_x11_set_icon
-rw-r--r--sokol_app.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sokol_app.h b/sokol_app.h
index 6dacdd35..2e635a52 100644
--- a/sokol_app.h
+++ b/sokol_app.h
@@ -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,