[all-commits] [llvm/llvm-project] 4c2f68: [CLANG] Fix potential integer overflow value in ge...

smanna12 via All-commits all-commits at lists.llvm.org
Wed Mar 27 15:17:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c2f68840e984b0f111779c46845ac00e3a7547d
      https://github.com/llvm/llvm-project/commit/4c2f68840e984b0f111779c46845ac00e3a7547d
  Author: smanna12 <soumi.manna at intel.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp

  Log Message:
  -----------
  [CLANG] Fix potential integer overflow value in getRVVTypeSize() (#86810)

In getRVVTypeSize(clang::ASTContext &, clang::BuiltinType const *)
potential integer overflow occurs on expression VScale->first * MinElts
with type unsigned int (32 bits, unsigned) is evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type uint64_t (64 bits, unsigned).

To avoid integer overflow, this patch changes the types of variables
MinElts and EltSize to uint64_t instead of the cast.

The change matches what was originally done in https://github.com/llvm/llvm-project/commit/7372c0d46d2185017c509eb30910b102b4f9cdaa. Looks like the revert happened in https://github.com/llvm/llvm-project/commit/c92ad411f2f94d8521cd18abcb37285f9a390ecb



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list