Bug 20544 – socket.remoteAddress throws out of memory error with unix domain socket peer
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2020-01-29T16:26:14Z
Last change time
2020-01-30T16:14:53Z
Assigned to
No Owner
Creator
Adam D. Ruppe
Comments
Comment #0 by destructionator — 2020-01-29T16:26:14Z
see:
import std.socket;
import std.stdio;
import std.concurrency;
void client() {
auto socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.connect(new UnixAddress("\0test"));
ubyte[128] buffer;
socket.receive(buffer[]);
socket.close();
}
void main() {
auto socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
socket.bind(new UnixAddress("\0test"));
socket.listen(1);
spawn(&client);
auto peer = socket.accept();
scope(exit) {
peer.send("");
peer.close();
socket.close();
}
writeln(peer.remoteAddress());
}
PR: https://github.com/dlang/phobos/pull/7383
Comment #1 by dlang-bot — 2020-01-29T16:27:45Z
@adamdruppe updated dlang/phobos pull request #7383 "obviously broken if len == 0" mentioning this issue:
- unittest for issue 20544
https://github.com/dlang/phobos/pull/7383
Comment #2 by dlang-bot — 2020-01-30T16:14:53Z
dlang/phobos pull request #7383 "Fix Issue 20544 - socket.remoteAddress throws out of memory error with unix domain socket peer" was merged into master:
- 7e3ac1d24cb925a8b21a4b287600a3dfc1c9308c by Adam D. Ruppe:
Fix Issue 20544 - socket.remoteAddress throws out of memory error with unix domain socket peer
https://github.com/dlang/phobos/pull/7383