Bug#947808: libvncserver: Please backport small patch to fix unaligned access on sparc64
Source: libvncserver
Version: 0.9.12+dfsg-5
Severity: normal
Tags: patch
User: debian-sparc@lists.debian.org
Usertags: sparc64
Hi!
The testsuite of libvncserver currently crashes on sparc64 due to
unaligned access:
Running tests...
/usr/bin/ctest --force-new-ctest-process -j32
Test project /<<PKGBUILDDIR>>/obj-sparc64-linux-gnu
Start 1: cargs
Start 2: turbojpeg
Start 3: wstest
1/3 Test #1: cargs ............................ Passed 0.01 sec
2/3 Test #3: wstest ...........................Bus error***Exception: 0.01 sec
3/3 Test #2: turbojpeg ........................ Passed 16.52 sec
67% tests passed, 1 tests failed out of 3
Total Test time (real) = 16.52 sec
This has been fixed upstream in:
commit 0cf1400c61850065de590d403f6d49e32882fd76
Author: Rolf Eike Beer <eike@sf-mail.de>
Date: Tue May 28 18:30:46 2019 +0200
fix crash because of unaligned accesses in hybiReadAndDecode()
I'm attaching the backported patch. Could you include it in the
next upload?
Thanks,
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz@debian.org
`. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
>From 0cf1400c61850065de590d403f6d49e32882fd76 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <eike@sf-mail.de>
Date: Tue, 28 May 2019 18:30:46 +0200
Subject: [PATCH] fix crash because of unaligned accesses in
hybiReadAndDecode()
---
libvncserver/ws_decode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libvncserver/ws_decode.c b/libvncserver/ws_decode.c
index 441ebc7..10c44d1 100644
--- a/libvncserver/ws_decode.c
+++ b/libvncserver/ws_decode.c
@@ -327,7 +327,6 @@ hybiReadAndDecode(ws_ctx_t *wsctx, char *dst, int len, int *sockRet, int nInBuf)
int bufsize;
int nextRead;
unsigned char *data;
- uint32_t *data32;
/* if data was carried over, copy to start of buffer */
memcpy(wsctx->writePos, wsctx->carryBuf, wsctx->carrylen);
@@ -383,10 +382,12 @@ hybiReadAndDecode(ws_ctx_t *wsctx, char *dst, int len, int *sockRet, int nInBuf)
/* for a possible base64 decoding, we decode multiples of 4 bytes until
* the whole frame is received and carry over any remaining bytes in the carry buf*/
data = (unsigned char *)(wsctx->writePos - toDecode);
- data32= (uint32_t *)data;
for (i = 0; i < (toDecode >> 2); i++) {
- data32[i] ^= wsctx->header.mask.u;
+ uint32_t tmp;
+ memcpy(&tmp, data + i * sizeof(tmp), sizeof(tmp));
+ tmp ^= wsctx->header.mask.u;
+ memcpy(data + i * sizeof(tmp), &tmp, sizeof(tmp));
}
ws_dbg("mask decoding; i=%d toDecode=%d\n", i, toDecode);
--
2.25.0.rc0
Reply to: