summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-10 10:40:46 +0200
committerwm4 <wm4@nowhere>2014-05-24 16:39:12 +0200
commit1b20ec4864d3b2e64addb28aaf29c6bbb888506e (patch)
treebf7a531707a120f712e84f6f232c76c8a2a47104
parentee529da7608acdef69f51647fe673289d0cbbda1 (diff)
downloadmpv-1b20ec4864d3b2e64addb28aaf29c6bbb888506e.tar.bz2
mpv-1b20ec4864d3b2e64addb28aaf29c6bbb888506e.tar.xz
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.
-rw-r--r--video/out/x11_common.c6
1 files 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,