summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-10 10:40:46 +0200
committerwm4 <wm4@nowhere>2014-05-10 10:44:16 +0200
commit26b00ffe8ace3b1063ef51ce678ec42e3745895b (patch)
treea784ab6d20157373bdb4902f12c5d8131a67a02e /video/out
parent3075ea01db452dd86c2e9422a6e61e67de264764 (diff)
downloadmpv-26b00ffe8ace3b1063ef51ce678ec42e3745895b.tar.bz2
mpv-26b00ffe8ace3b1063ef51ce678ec42e3745895b.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.
Diffstat (limited to 'video/out')
-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 e1441e2957..c84409b03c 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1221,9 +1221,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,