[clang] [compiler-rt] [libcxx] [clang] Add unistd fortify checks and analyzer size constraints (PR #196499)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Tue May 12 00:42:57 PDT 2026


================
@@ -370,3 +370,61 @@ void test_file_fd_at_functions() {
   (void)readlinkat(AT_FDCWD, "newpath", Buf, 10);
   (void)renameat(AT_FDCWD, "oldpath", AT_FDCWD, "newpath");
 }
+
+#define SSIZE_MAX_PLUS_ONE ((size_t)1 << (sizeof(size_t) * __CHAR_BIT__ - 1))
+
+void test_read_ssize_max_io_size(int fd, char *Buf) {
+  read(fd, Buf, SSIZE_MAX_PLUS_ONE); // \
+  // report-warning{{The 3rd argument to 'read' is 9223372036854775808 but should be a value not greater than SSIZE_MAX}} \
----------------
ojhunt wrote:

Just use `@-1`,`@-2`, etc

https://github.com/llvm/llvm-project/pull/196499


More information about the cfe-commits mailing list