[clang] [clang][analyzer] fix crash when modelling 'getline' function in checkers (PR #145229)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 24 07:25:48 PDT 2025
================
@@ -369,6 +380,9 @@ ProgramStateRef UnixAPIMisuseChecker::EnsureGetdelimBufferAndSizeCorrect(
void UnixAPIMisuseChecker::CheckGetDelim(CheckerContext &C,
const CallEvent &Call) const {
+ if (Call.getNumArgs() < 2)
+ return;
----------------
vbvictor wrote:
`CheckGetDelim` process both `getline` and `getdelim` functions, so the condition must be
`!= 3 || != 4`.
As for now, I go for "if it doesn't crush, let it work", thus test case `TEST_GETLINE_2` works even with no 3rd parameter provided.
I can make this condition more strict.
https://github.com/llvm/llvm-project/pull/145229
More information about the cfe-commits
mailing list