[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:38:37 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:

I think the confusion was the function name. Could you rename it to `CheckGetDelimOrGetline`. The `if (Call.getNumArgs() < 2)` should be fine as is I think.

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


More information about the cfe-commits mailing list