[llvm] [FIX] Fix undefined-behaviour in regex engine. (PR #73071)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 00:57:47 PST 2023


================
@@ -82,8 +82,8 @@ unsigned Regex::getNumMatches() const {
 
 bool Regex::match(StringRef String, SmallVectorImpl<StringRef> *Matches,
                   std::string *Error) const {
-  // Exit without match if string is empty
-  if (String.empty())
+  // No match for null string data
+  if (String.data() == nullptr)
----------------
tanmaysachan wrote:

Thanks! Updating commit.

https://github.com/llvm/llvm-project/pull/73071


More information about the llvm-commits mailing list