[clang] [clang][StaticAnalyzer] Adding getentropy to CStringChecker. (PR #83675)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 22 06:13:08 PDT 2024
================
@@ -2515,6 +2517,53 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call,
C.addTransition(State);
}
+void CStringChecker::evalGetentropy(CheckerContext &C, const CallEvent &Call) const {
+ DestinationArgExpr Buffer = {{Call.getArgExpr(0), 0}};
+ SizeArgExpr Size = {{Call.getArgExpr(1), 1}};
+ ProgramStateRef State = C.getState();
+ SValBuilder &SVB = C.getSValBuilder();
+ SVal MaxLength = SVB.makeIntVal(256, C.getASTContext().IntTy);
+
+ SVal SizeVal = C.getSVal(Size.Expression);
+ QualType SizeTy = Size.Expression->getType();
+
+ ProgramStateRef StateZeroSize, StateNonZeroSize;
+ std::tie(StateZeroSize, StateNonZeroSize) =
----------------
NagyDonat wrote:
```suggestion
auto [StateZeroSize, StateNonZeroSize] =
```
We have C++17, we can use structured bindings instead of `std::tie`.
https://github.com/llvm/llvm-project/pull/83675
More information about the cfe-commits
mailing list