[clang] [clang][analyzer] Fix argument invalidations in StreamChecker. (PR #79470)

Alejandro Álvarez Ayllón via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 06:08:50 PST 2024


================
@@ -763,6 +779,11 @@ void StreamChecker::evalFreadFwrite(const FnDescription *Desc,
     return;
   }
 
+  // At read, invalidate the buffer in any case of error or success,
+  // except if EOF was already present.
+  if (IsFread && (OldSS->ErrorState != ErrorFEof))
+    State = escapeArgs(State, C, Call, {0});
----------------
alejandro-alvarez-sonarsource wrote:

Here it is: https://gist.github.com/alejandro-alvarez-sonarsource/48edec4debc8912a6485f989b2a6f0db

I have rebased it on top of 4f12f47550eee85447c9ec37d27a20c6593d3d40 and run check-clang to make sure I didn't break anything.

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


More information about the cfe-commits mailing list