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 in BasicValueFactory.cpp with __int128_t integers #67212

Merged
merged 1 commit into from
Oct 2, 2023

Commits on Oct 2, 2023

  1. [analyzer] Fix crash in BasicValueFactory.cpp with __int128_t integers

    This change avoids a crash in BasicValueFactory by checking the bit
    width of an APSInt to avoid calling getZExtValue if greater than
    64-bits.
    
    Clang invocation
    clang -cc1 -analyzer-checker=optin.portability.UnixAPI case.c
    
    <src-root>/llvm/include/llvm/ADT/APInt.h:1488:
    uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64
      && "Too many bits for uint64_t"' failed.
    ...
    
     llvm#9 <address> llvm::APInt::getZExtValue() const
         <src-root>/llvm/include/llvm/ADT/APInt.h:1488:5
         clang::BinaryOperatorKind, llvm::APSInt const&, llvm::APSInt const&)
         <src-root>/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp:307:37
         llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>,
         clang::BinaryOperatorKind, clang::ento::NonLoc, clang::ento::NonLoc,
         clang::QualType)
         <src-root>/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:531:31
         llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>,
         clang::BinaryOperatorKind, clang::ento::SVal, clang::ento::SVal,
         clang::QualType)
         <src-root>/clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:532:26
    ...
    vabridgers authored and einvbri committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    2467ec4 View commit details
    Browse the repository at this point in the history