[all-commits] [llvm/llvm-project] deca80: Avoid nullptr+0 in Regex (#73071)

Tanmay via All-commits all-commits at lists.llvm.org
Fri Dec 1 11:29:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: deca8055d4f590047730df4a6806e06d623ef1ff
      https://github.com/llvm/llvm-project/commit/deca8055d4f590047730df4a6806e06d623ef1ff
  Author: Tanmay <tnmysachan at gmail.com>
  Date:   2023-12-01 (Fri, 01 Dec 2023)

  Changed paths:
    M llvm/lib/Support/Regex.cpp
    M llvm/unittests/Support/RegexTest.cpp

  Log Message:
  -----------
  Avoid nullptr+0 in Regex (#73071)

A zero-length StringRef can have a null data pointer, which, if passed to the llvm_regex functions which take a pointer+length, but then convert it into a [begin, end) pointer pair can cause a nullptr+0 expression to be evaluated, which is UB. So avoid that by ensuring the data pointer is always non-null, even in the zero-length case.




More information about the All-commits mailing list