[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:23:03 PST 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG816b5e546c65: [libc] remove use after free in tests. (authored by michaelrj).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139878/new/

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.482247.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221212/a0cff2ba/attachment.bin>


More information about the libc-commits mailing list