[libc-commits] [PATCH] D139878: [libc] remove use after free in tests.
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Dec 12 13:22:43 PST 2022
michaelrj created this revision.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
michaelrj requested review of this revision.
There were some tests added that attempted to access files after they
were closed to test errno behavior, this caused sanitizer issues. Those
portions of the tests have been disabled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139878
Files:
libc/test/src/stdio/fileop_test.cpp
libc/test/src/stdio/ftell_test.cpp
Index: libc/test/src/stdio/ftell_test.cpp
===================================================================
--- libc/test/src/stdio/ftell_test.cpp
+++ libc/test/src/stdio/ftell_test.cpp
@@ -55,9 +55,9 @@
ASSERT_EQ(0, __llvm_libc::fclose(file));
- errno = 0;
- ASSERT_EQ(__llvm_libc::ftell(file), long(-1));
- ASSERT_NE(errno, 0);
+ // errno = 0;
+ // ASSERT_EQ(__llvm_libc::ftell(file), long(-1));
+ // ASSERT_NE(errno, 0);
}
};
Index: libc/test/src/stdio/fileop_test.cpp
===================================================================
--- libc/test/src/stdio/fileop_test.cpp
+++ libc/test/src/stdio/fileop_test.cpp
@@ -114,18 +114,18 @@
// Check that the other functions correctly set errno.
- errno = 0;
- ASSERT_NE(__llvm_libc::fseek(file, 0, SEEK_SET), 0);
- EXPECT_NE(errno, 0);
-
- errno = 0;
- ASSERT_NE(__llvm_libc::fclose(file), 0);
- EXPECT_NE(errno, 0);
-
- errno = 0;
- ASSERT_EQ(__llvm_libc::fopen("INVALID FILE NAME", "r"),
- static_cast<FILE *>(nullptr));
- EXPECT_NE(errno, 0);
+ // errno = 0;
+ // ASSERT_NE(__llvm_libc::fseek(file, 0, SEEK_SET), 0);
+ // EXPECT_NE(errno, 0);
+
+ // errno = 0;
+ // ASSERT_NE(__llvm_libc::fclose(file), 0);
+ // EXPECT_NE(errno, 0);
+
+ // errno = 0;
+ // ASSERT_EQ(__llvm_libc::fopen("INVALID FILE NAME", "r"),
+ // static_cast<FILE *>(nullptr));
+ // EXPECT_NE(errno, 0);
}
TEST(LlvmLibcFILETest, FFlush) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139878.482246.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221212/226122a9/attachment.bin>
More information about the libc-commits
mailing list