]> sourceware.org Git - glibc.git/commit
Add another test for fclose on an unopened file
authorAaron Merey <amerey@redhat.com>
Thu, 19 Sep 2024 13:53:23 +0000 (09:53 -0400)
committerAaron Merey <amerey@redhat.com>
Fri, 20 Sep 2024 14:32:35 +0000 (10:32 -0400)
commit35dc62de3d5d73a91d4ca8fa9799b510a34d170d
tree6a6704266c489d3130929130e570a9aa392624cb
parentfa1b0d5e9f6e0353e16339430770a7a8824c0468
Add another test for fclose on an unopened file

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

This test differs from tst-fclose-unopened.c by ensuring the file's buffer
is allocated prior to double-fclose.  A comment in tst-fclose-unopened.c
now clarifies that it is testing a file with an unallocated buffer.

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.

Tested for x86_64.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
libio/Makefile
libio/tst-fclose-unopened.c
libio/tst-fclose-unopened2.c [new file with mode: 0644]
libio/tst-fclose-unopened2.input [new file with mode: 0644]
This page took 0.035444 seconds and 5 git commands to generate.