[all-commits] [llvm/llvm-project] 33b6b6: [clang] Fix crash in __builtin_strncmp and other r...

Shafik Yaghmour via All-commits all-commits at lists.llvm.org
Fri Aug 25 13:55:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33b6b674620d77e615d569f504b306aac528bab7
      https://github.com/llvm/llvm-project/commit/33b6b674620d77e615d569f504b306aac528bab7
  Author: Shafik Yaghmour <shafik.yaghmour at intel.com>
  Date:   2023-08-25 (Fri, 25 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/ExprConstant.cpp
    A clang/test/CodeGen/gh64876.cpp
    M clang/test/SemaCXX/constexpr-string.cpp

  Log Message:
  -----------
  [clang] Fix crash in __builtin_strncmp and other related builtin functions

The implementation of __builtin_strncmp and other related builtins function use
getExtValue() to evaluate the size argument. This can cause a crash when the
value does not fit into an int64_t value, which is can be expected since the
type of the argument is size_t.

The fix is to switch to using getZExtValue().

This fixes: https://github.com/llvm/llvm-project/issues/64876

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




More information about the All-commits mailing list