From 1b20ec4864d3b2e64addb28aaf29c6bbb888506e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 10 May 2014 10:40:46 +0200 Subject: x11: fix potentially unaligned access in icon loader Tried to load a 32 bit value by dereferencing a uint32_t pointer, but the pointer is not guaranteed to be aligned, not even in practice. --- video/out/x11_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index b9245d73c6..07d3713f5d 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -1054,9 +1054,9 @@ static void vo_x11_set_wm_icon(struct vo_x11_state *x11) for (int n = 0; n < num_icons; n++) { *cur++ = icon_w[n]; *cur++ = icon_h[n]; - uint32_t *src = icon_data[n]; - for (int i = 0; i < icon_h[n] * icon_w[n]; i++) - *cur++ = src[i]; + uint8_t *s = icon_data[n]; + for (int i = 0; i < icon_h[n] * icon_w[n]; i++, s += 4) + *cur++ = s[0] | (s[1] << 8) | (s[2] << 16) | ((unsigned)s[3] << 24); } XChangeProperty(x11->display, x11->window, x11->XA_NET_WM_ICON, -- cgit v1.2.3