[clang] [analyzer] Fix StreamChecker crash in fread modeling (PR #108393)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 07:07:07 PDT 2024


================
@@ -443,3 +443,33 @@ void test_unaligned_start_read(void) {
     fclose(fp);
   }
 }
+
+void no_crash_if_count_is_negative(long s, unsigned char *buffer) {
+  FILE *fp = fopen("path", "r");
+  if (fp) {
+    if (s * s == -1) {
----------------
steakhal wrote:

Yea, I noticed that too. I figured it's a funny example, but refining it is also good.

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


More information about the cfe-commits mailing list