[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: libsvn_subr/utf-test failure due to unaligned memory access

From: Branko Čibej <brane_at_apache.org>
Date: Sat, 3 Mar 2018 20:28:15 +0100

On 03.03.2018 20:18, James McCoy wrote:
> This test has been failing for some time on Debian's alpha buildd[0].
> One of the alpha porters looked into it and gave a thorough diagnosis[1]
> of the issue which basically boils down to: using a char* as
> apr_uint16_t*/apr_int32_t* is going to result in unaligned access.
> In a (much belated) reply[2], I proposed the attached patch which
> memcpy()s the string to an array of the appropriate type before passing
> it through to svn_utf__utf{16,32}_to_utf8(). I also took the
> opportunity to consolidate the handing of counted and non-counted
> conversions.
> Does this look appropriate? If so, I can commit to trunk and nominate
> for 1.10.

So it's a case of the Alpha compiler not aligning static string
constants to struct boundary? I wouldn't have expected that ... but I
believe the compiler is correct as per standard.

In any case: please use sizeof() and strlen() instead of explicit
numbers in the test data and buffer sizes.

-- Brane
Received on 2018-03-03 20:28:21 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.