From: Andrej Mihajlov <and@mullvad.net>
To: Houman <houmie@gmail.com>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Wireguard iOS crashes after upgrading to XCode 14
Date: Thu, 22 Sep 2022 10:31:52 +0200 [thread overview]
Message-ID: <834CB179-958C-4C0E-8B17-9918C8A992FB@mullvad.net> (raw)
In-Reply-To: <CABBZOsks3ZnpcURYHSQcaWCe8ETY21zitPY5TvtTaAm38DT5EA@mail.gmail.com>
Hi,
I think we have a bug. If I am right, basically in both IPv4 and IPv6 extensions, withMemoryRebound takes capacity which is actually a number of instances of a given type (sockaddr_ variant) and not the byte size of a struct.
Could you please patch your WireGuardKit with the following commit and see if it helps?
https://git.zx2c4.com/wireguard-apple/commit/?h=am/fix-addrinfo-crash
Best regards,
Andrey Mikhaylov
> On 13 Sep 2022, at 14:41, Houman <houmie@gmail.com> wrote:
>
> My existing Wireguard iOS implementation stopped working after
> upgrading to Xcode 14 today.
> When trying to connect to servers that support only IPv4, then it's
> fine. But if the server supports both IPv6 and IPv4 then the tunnel
> crashes:
>
> This IPv6 extension in
> wireguard-apple/Sources/WireGuardKit/IPAddress+AddrInfo.swift crashes
> with a Fatal Error at addrInfo.ai_addr.withMemoryRebound()
>
> The whole extension below:
>
> extension IPv6Address {
> init?(addrInfo: addrinfo) {
> guard addrInfo.ai_family == AF_INET6 else { return nil }
>
> let addressData = addrInfo.ai_addr.withMemoryRebound(to:
> sockaddr_in6.self, capacity: MemoryLayout<sockaddr_in6>.size) { ptr ->
> Data in
> return Data(bytes: &ptr.pointee.sin6_addr, count:
> MemoryLayout<in6_addr>.size)
> }
> self.init(addressData)
> }
> }
>
> Has anyone else experienced this problem?
>
> Thanks,
next prev parent reply other threads:[~2022-09-22 8:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 12:41 Houman
2022-09-22 8:31 ` Andrej Mihajlov [this message]
2022-09-22 8:56 ` Houman
2022-09-22 9:38 ` Jason A. Donenfeld
2022-09-22 9:39 ` Houman
2022-12-05 17:15 ` Houman
2022-12-05 17:40 ` Jason A. Donenfeld
2022-09-22 9:44 ` Andrej Mihajlov
2022-09-22 9:46 ` Houman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=834CB179-958C-4C0E-8B17-9918C8A992FB@mullvad.net \
--to=and@mullvad.net \
--cc=houmie@gmail.com \
--cc=wireguard@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).