[PATCH] libio: Add nonnull attribute for most FILE * arguments in stdio.h
Xi Ruoyao
xry111@xry111.site
Fri May 19 05:21:47 GMT 2023
On Fri, 2023-05-19 at 12:13 +0800, Xi Ruoyao wrote:
> On Thu, 2023-05-18 at 20:29 +0200, Alex Colomar wrote:
> > On 5/18/23 20:06, Alex Colomar wrote:
> > > Hi Xi!
> > >
> > > On 5/18/23 19:25, Xi Ruoyao via Libc-alpha wrote:
> > > > During the review of a GCC analyzer test case, we found most stdio
> > > > functions accepting a FILE * argument expect it to be nonnull and
> > > > just
> > > > segfault when the argument is NULL. Add nonnull attribute for
> > > > them.
> > > >
> > > > setbuf is well defined when __stream is NULL so it's not touched.
> >
> > Is this true? I couldn't find anything about it in either setbuf(3),
> > setbuf(3POSIX), or info libc.
> >
> > The buffer can be NULL, but the stream?
>
> I guess when I took the note on the paper I misspelled "fflush" as
> "setbuf" for some reason (maybe lack of coffee :( ).
>
> I'll retest all the changes in one hour or two hours.
I've sent v2 with the mistakes in fflush, fflush_unlocked, and setbuf
fixed. Thanks for pointing out my mistake!
I guess I need to avoid creating a patch at 0100 AM in the future :).
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
More information about the Libc-alpha
mailing list