[clang] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 07:10:01 PDT 2025


================
@@ -369,6 +380,9 @@ ProgramStateRef UnixAPIMisuseChecker::EnsureGetdelimBufferAndSizeCorrect(
 
 void UnixAPIMisuseChecker::CheckGetDelim(CheckerContext &C,
                                          const CallEvent &Call) const {
+  if (Call.getNumArgs() < 2)
+    return;
----------------
steakhal wrote:

Why don't we check `!= 4` here? By judging the function name we should only accept the `getdelim` function that has 4 parameters (thus arguments).

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


More information about the cfe-commits mailing list