Date: Fri, 24 Feb 2023 09:42:00 -0500 From: Tamir Duberstein <tamird@...gle.com> To: NRK <nrk@...root.org> Cc: Rich Felker <dalias@...c.org>, musl@...ts.openwall.com Subject: Re: undefined behavior in fread.c We could take the lock and still avoid UB with an early return. On Fri, Feb 24, 2023, 09:17 NRK <nrk@...root.org> wrote: > On Fri, Feb 24, 2023 at 09:07:41AM -0500, Rich Felker wrote: > > stdio functions are required (by POSIX) to behave as if they take a > > mutex on the FILE. If fread with a length of zero makes forward > > progress when another thread holds the lock, this is non-conforming. > > OK, I see. Wasn't aware of that. > > On a sidenote, if I'm reading the right function (libio/iofread.c) then > glibc is taking the lock _after_ they do the size check. > > if (bytes_requested == 0) > return 0; > _IO_acquire_lock (fp); > /* ... */ > > - NRK > Content of type "text/html" skipped
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.