[all-commits] [llvm/llvm-project] 8628ca: [libc] Fix UB in memory utils (#74295)

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Mon Dec 4 01:57:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8628ca29aa4714f99e865c99b9d510ad14897fdc
      https://github.com/llvm/llvm-project/commit/8628ca29aa4714f99e865c99b9d510ad14897fdc
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M libc/src/string/memory_utils/utils.h

  Log Message:
  -----------
  [libc] Fix UB in memory utils (#74295)

The [standard](https://eel.is/c++draft/expr.add#4.3) forbids forming
pointers to invalid objects even if the pointer is never read from or
written to. This patch makes sure that we don't do pointer arithmetic on
invalid pointers.


Co-authored-by: Vitaly Buka <vitalybuka at google.com>




More information about the All-commits mailing list