[all-commits] [llvm/llvm-project] 6664e8: Fix integer overflow in ConcurrentHashtTableByPtr

Andy Kaylor via All-commits all-commits at lists.llvm.org
Wed Aug 16 15:43:35 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6664e80ace0845d34eecebe0d5da0b576cde39ef
      https://github.com/llvm/llvm-project/commit/6664e80ace0845d34eecebe0d5da0b576cde39ef
  Author: Andy Kaylor <andrew.kaylor at intel.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M llvm/include/llvm/ADT/ConcurrentHashtable.h

  Log Message:
  -----------
  Fix integer overflow in ConcurrentHashtTableByPtr

This change fixes a case where there was a potential integer overflow
when multiplying two 32-bit values and assigning the result to a 64-bit
value.

The potential overflow has been present since https://reviews.llvm.org/D132455
was re-landed. The initial version of the patch defined MaxBucketSize and
NumberOfBuckets as size_t (which I guess would still be a problem for some
targets). When the patch was re-landed they were defined as uint32_t, making
the calculation of ExtHashMask subject to overflow.

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




More information about the All-commits mailing list