]> sourceware.org Git - glibc.git/commit
Test fclose on an unopened file.
authorAaron Merey <amerey@redhat.com>
Thu, 29 Aug 2024 16:02:25 +0000 (12:02 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 5 Sep 2024 13:55:27 +0000 (09:55 -0400)
commit3e4a01870ef9605ccf6475215a4b32aa86d5d206
treee5355a5ecf5d6bdaea6a47b68bb458ccaf887cc6
parent9c0d6f7a1046aba111e25e34ec07242853e859dc
Test fclose on an unopened file.

Add new file libio/tst-fclosed-unopened.c that tests whether fclose on
an unopened file returns EOF.

Calling fclose on unopened files normally causes a use-after-free bug,
however the standard streams are an exception since they are not
deallocated by fclose.

fclose returning EOF for unopened files is not part of the external
contract but there are dependancies on this behaviour.  For example,
gnulib's close_stdout in lib/closeout.c.

Tested for x86_64.

Signed-off-by: Aaron Merey <amerey@redhat.com>
libio/Makefile
libio/tst-fclose-unopened.c [new file with mode: 0644]
This page took 0.038871 seconds and 5 git commands to generate.