-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXC_BAD_ACCESS when connect to unix domain socket #139
Comments
Can you give me a more complete example? So far, I've been unable to reproduce the problem. |
I'm also getting an do {
let okPath = "111111111111111111111111111111111"
assert(okPath.utf8.count == 33)
_ = try Socket.Signature(socketType: .stream, proto: .unix, path: okPath) // ok
let problematicPath = okPath + "1"
assert(problematicPath.utf8.count > 33)
_ = try Socket.Signature(socketType: .stream, proto: .unix, path: problematicPath) // EXC_BAD_ACCESS
} catch {
print(error)
} |
Thanks for the example. I'll have a look at it. Seems like it should be relatively easy to fix. Thanks again. |
I've added a test that basically mimics what you provided above and it passes without any problem on the same version of macOS, 10.13.6. So, at this point, I still can't reproduce. |
I've issued a new release that contains the new test. That version, 1.0.15, is available. |
@billabt Hm, that's odd. Here's what I did:
But yes, if I clone BlueSocket and do |
Can you zip up the project and send it to me? Thanks. |
Here it is: SocketTest.zip |
I was able to run your project without issue... Are you still having the problem? |
@billabt I was able to reproduce it more easily:
I changed the following in my fork:
When I run all tests I get the following at some point: When I run only (I'm on macOS 10.13.6 and using Xcode 9.4.1.) |
I'm having the same issues with Xcode 10.0 |
It took awhile to find it... It turns out this is an optimization bug. In the first case, when built optimized, the path variable passed is for some unknown reason set to an empty string while in the listen function. In the second case, the function succeeds but fails to return properly. Not sure why either is happening but I plan to file a bug report with Apple. In the meantime, you can change project to turn off optimization. |
I decided to look a bit deeper into this. Turns out there was a buffer overflow happening in the initializer for Signature but only when the optimizer was turned on. This'll be fixed in the next release which should come out very shortly... Thanks. |
Fixed in version 1.0.19. Let me know if you have any more problems. Thanks. |
Thanks! The issue is gone. |
I have a unix domain socket created by tokio-uds, and I can make connection with it normally by
net.socket
of node.js.But when I connect to this socket via BlueSocket:
would cause crash at
Socket.swift:1927
:If I use it this way:
Will throw an exception:
This problem is very weird, and I have confirmed that the cocoa's sandbox mechanism is turned off and that FileManager can also obtain socket file stats.
The text was updated successfully, but these errors were encountered: