[Bug libc/21531] fclose with NULL is SEGV should set errno EFAULT or EBADF
joseph at codesourcery dot com
sourceware-bugzilla@sourceware.org
Thu Jun 1 15:31:00 GMT 2017
https://sourceware.org/bugzilla/show_bug.cgi?id=21531
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The glibc rule is that "If it's user code invoking undefined behavior,
then it should fail early and catastrophically". Thus NULL checks, where
NULL is undefined behavior, should be avoided; an unconditional
dereference is preferred (and if for any reason there is a check because
there isn't an immediate unconditional dereference, such a check should
call assert () and terminate the program).
https://sourceware.org/glibc/wiki/Style_and_Conventions#Bugs_in_the_user_program
https://sourceware.org/glibc/wiki/Style_and_Conventions#Invalid_pointers
The *_s functions are poorly designed (even for retrofitting existing
low-quality code) and Annex K has been specifically rejected for glibc.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list