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

smanna12 via All-commits all-commits at lists.llvm.org
Wed Jun 28 19:30:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7372c0d46d2185017c509eb30910b102b4f9cdaa
      https://github.com/llvm/llvm-project/commit/7372c0d46d2185017c509eb30910b102b4f9cdaa
  Author: Manna, Soumi <soumi.manna at intel.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

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

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

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 from unsigned instead of the cast.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D153146




More information about the All-commits mailing list