<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl.xml"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Changes in close.pass.cpp</title>
    <description></description>
    <language>en</language>
    <copyright>Copyright 2015</copyright>
    <generator>Java</generator><item>
        <title>89385633 - [libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose fails</title>
        <link>http://172.16.0.5:8080/history/llvm-project-15.0.7/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp#89385633</link>
        <description>[libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose failsThis issue was detected by ASan in one of our tests. This test manuallyinvokes basic_filebuf::cloe(). fclose(__h.release() returned a non-zeroexit status, so __file_ wasn&apos;t set to 0. Later when basic_filebufdestructor ran, we would enter the if (__file_) block again leading toheap-use-after-free error.The POSIX specification for fclose says that independently of the returnvalue, fclose closes the underlying file descriptor and any furtheraccess (including another call to fclose()) to the stream results inundefined behavior. This is exactly what happened in our test case.To avoid this issue, we have to always set __file_ to 0 independently ofthe fclose return value.Differential Revision: https://reviews.llvm.org/D64979llvm-svn: 366730

            List of files:
            /llvm-project-15.0.7/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/close.pass.cpp</description>
        <pubDate>Mon, 22 Jul 2019 19:54:34 +0000</pubDate>
        <dc:creator>Petr Hosek &lt;phosek@chromium.org&gt;</dc:creator>
    </item>
</channel>
</rss>
