digitalmars.D.bugs - [Issue 19247] New: Segmentation fault when resolving address with
- d-bugmail puremagic.com (31/57) Sep 14 2018 https://issues.dlang.org/show_bug.cgi?id=19247
https://issues.dlang.org/show_bug.cgi?id=19247 Issue ID: 19247 Summary: Segmentation fault when resolving address with std.socket.getAddress inside a Fiber Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: zorael gmail.com Manjaro/Arch x86_64. dmd 2.082, ldc v1.11 from repositories. Resolving an invalid address with no dots, such as "asdf", causes a segmentation fault. Resolving a nonexistent address throws an exception, as it should, and valid addresses resolve fine. Noteworthy is that it started after I moved the resolving into a function run as a Generator Fiber. Calls to getAddress outside of it seem to work fine. Unsure if that's relevant. Tested on two machines running Linux, with dmd and ldc. On a Windows machine however it properly threw a SocketOSException: getaddrinfo error: No such host is known. Reduced example (31 lines) is at the resolveseg branch of https://github.com/zorael/kameloso.$ git clone https://github.com/zorael/kameloso.git -b resolveseg $ cd kameloso $ ./tester 0x00007ffff7a583a8 in __res_context_hostalias () from /usr/lib/libresolv.so.2Manually, invalid address:$ gdb --batch -ex run --args kameloso wefpok [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Attempting to resolve wefpok Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7a583a8 in __res_context_hostalias () from /usr/lib/libresolv.so.2Manually, valid address:$ gdb --batch -ex run --args kameloso dlang.org [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Attempting to resolve dlang.org Success [Inferior 1 (process 15589) exited normally]Random changes to the source makes it segfault in getenv in libc.so.6 instead. For instance, version/comment out the foreach in resolveFiber in connection.d.(gdb) bt /usr/lib/libresolv.so.2 /usr/lib/libnss_dns.so.2 _D3std6socket18getAddressInfoImplFMAxaMQePS4core3sys5posix5netdb8addrinfoZA QCwQCv11AddressInfo () from /usr/lib/libphobos2.so.0.82 [...]--
Sep 14 2018