Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[analyzer] Fix crash analyzing _BitInt() in evalIntegralCast #65887

Merged
merged 1 commit into from
Sep 18, 2023

Commits on Sep 18, 2023

  1. [analyzer] Fix crash analyzing _BitInt() in evalIntegralCast

    evalIntegralCast was using makeIntVal, and when _BitInt() types were
    introduced this exposed a crash in evalIntegralCast as a result.
    
    Improve evalIntegralCast to use makeIntVal more efficiently to avoid the
    crash exposed by use of _BitInt.
    
    This was caught with our internal randomized testing.
    
    <src-root>/llvm/include/llvm/ADT/APInt.h:1510:
      int64_t llvm::APInt::getSExtValue() const: Assertion
      `getSignificantBits() <= 64 && "Too many bits for int64_t"' failed.a
    
    ...
     llvm#9 <address> llvm::APInt::getSExtValue() const
      <src-root>/llvm/include/llvm/ADT/APInt.h:1510:5
      llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>,
      clang::ento::SVal, clang::QualType, clang::QualType)
      <src-root>/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:607:24
      clang::Expr const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
      <src-root>/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp:413:61
    ...
    
     Fixes: llvm#61960
    
     Reviewed By: donat.nagy
    vabridgers authored and einvbri committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    ea63aae View commit details
    Browse the repository at this point in the history