[all-commits] [llvm/llvm-project] 55160e: [ConstEval] Fix crash when comparing strings past ...

Henrik G. Olsson via All-commits all-commits at lists.llvm.org
Wed Apr 23 16:41:42 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 55160e6a89820f219eaa218fa02da2006213ed2c
      https://github.com/llvm/llvm-project/commit/55160e6a89820f219eaa218fa02da2006213ed2c
  Author: Henrik G. Olsson <hnrklssn at gmail.com>
  Date:   2025-04-23 (Wed, 23 Apr 2025)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/AST/ByteCode/cxx20.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp

  Log Message:
  -----------
  [ConstEval] Fix crash when comparing strings past the end (#137078)

When `ArePotentiallyOverlappingStringLiterals`, added in
https://github.com/llvm/llvm-project/pull/109208, compares string
literals it drops the front of the string with the greatest offset from
its base pointer. The number of characters dropped is equal to the
difference between the two strings' offsets from their base pointers.
This would trigger an assert when the resulting offset is past the end
of the object. Not only are one-past-the-end pointers legal constructs,
the compiler should not crash even when faced with illegal constructs.

rdar://149865910



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