This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix null pointer in mtrace


* liqingqing:

> I had tested this scenario, it seems like that the fprintf and other
> file operation function do not check the invalid argument like the
> null pointer.  does any one knows why fprintf do not check the input?

It's not required by the standard because violating preconditions
results in undefined behavior.  Sloppily written code with such bugs
tends to not check error returns from functions, either.  This means if
we added a null check for the stream argument to fprintf (e.g., failing
with EINVAL in that case), it would only obscure the problem and make
diagnosis even more difficult.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]