[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/5] vnc: fix unalignment access in tight_pack24
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/5] vnc: fix unalignment access in tight_pack24 |
Date: |
Mon, 18 Mar 2019 12:20:34 +0100 |
From: Li Qiang <address@hidden>
When adding '-fsanitize=undefined' in compiling configuration
and connect VM with vnc, it reports following error:
ui/vnc-enc-tight.c:910:13: runtime error: load of
misaligned address 0x621000466513 for type 'uint32_t',
which requires 4 byte alignment
This patch fix this issue.
Signed-off-by: Li Qiang <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/vnc-enc-tight.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index 0b4a5ac71f77..d20cd1d86dfe 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -886,11 +886,11 @@ static int tight_compress_data(VncState *vs, int
stream_id, size_t bytes,
*/
static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret)
{
- uint32_t *buf32;
+ uint8_t *buf8;
uint32_t pix;
int rshift, gshift, bshift;
- buf32 = (uint32_t *)buf;
+ buf8 = buf;
if (1 /* FIXME */) {
rshift = vs->client_pf.rshift;
@@ -907,10 +907,11 @@ static void tight_pack24(VncState *vs, uint8_t *buf,
size_t count, size_t *ret)
}
while (count--) {
- pix = *buf32++;
+ pix = ldl_he_p(buf8);
*buf++ = (char)(pix >> rshift);
*buf++ = (char)(pix >> gshift);
*buf++ = (char)(pix >> bshift);
+ buf8 += 4;
}
}
--
2.18.1
- [Qemu-devel] [PULL 0/5] Ui 20190318 patches, Gerd Hoffmann, 2019/03/18
- [Qemu-devel] [PULL 2/5] curses ui: always initialize all curses_line fields, Gerd Hoffmann, 2019/03/18
- [Qemu-devel] [PULL 4/5] keymaps: use nodeadkeys variant for de and fr, Gerd Hoffmann, 2019/03/18
- [Qemu-devel] [PULL 3/5] curses ui: add missing iconv_close calls, Gerd Hoffmann, 2019/03/18
- [Qemu-devel] [PULL 1/5] vnc: fix unalignment access in tight_pack24,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 5/5] keymaps: regenerate keymaps, Gerd Hoffmann, 2019/03/18
- Re: [Qemu-devel] [PULL 0/5] Ui 20190318 patches, Peter Maydell, 2019/03/18