|
Message-ID: <20190201002716.GK23599@brightrain.aerifal.cx> Date: Thu, 31 Jan 2019 19:27:16 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Cc: "De Paula, Judah" <judah.depaula@...neer.com> Subject: Re: closedir() On Thu, Jan 31, 2019 at 09:58:06PM +0000, De Paula, Judah wrote: > Hi MUSLers, > > Possible bug report? I’m not on your DL, but would like to hear back > if you find this helpful. > > I’m working on an internal corporate application using Docker and > Alpine. Under normal Fedora my app calls closedir(NULL) and a -1 is > returned. Under MUSL, it segfaults. I’m changing the code to not > call closedir() with a null pointer, but I’m not certain segfaults > are considered Working As Designed. > > http://man7.org/linux/man-pages/man3/closedir.3.html Hi, Passing an invalid pointer to closedir is undefined behavior, and in musl the preferred effect for undefined behavior when it's not costly to attempt to detect is a quick crash so that the point of error in the program can be identified and fixed. For what it's worth, glibc has also adopted this view based on text I wrote: https://sourceware.org/glibc/wiki/Style_and_Conventions#Invalid_pointers However I doubt they will change existing functions where they have traditionally accepted null arguments as a nop. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.