[clang] [clang][StaticAnalyzer] Fix crash in SimpleSValBuilder with unsigned __int128 and negative literals (PR #150225)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 25 06:16:48 PDT 2025


================
@@ -538,9 +553,12 @@ SVal SimpleSValBuilder::evalBinOpNN(ProgramStateRef state,
           CompareType.apply(LHSValue);
           CompareType.apply(RHSValue);
         } else if (!BinaryOperator::isShiftOp(op)) {
-          APSIntType IntType = BasicVals.getAPSIntType(resultTy);
-          IntType.apply(LHSValue);
-          IntType.apply(RHSValue);
+          // Check if resultTy is valid before using it
+          if (!resultTy.isNull()) {
----------------
steakhal wrote:

Checking the `resultTy` here and there without systematic guarantees doesn't seem like the right approach.
We should think about making this bulletproof somehow.

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


More information about the cfe-commits mailing list