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

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 17:46:33 PST 2023


================
@@ -146,7 +146,9 @@ matcher(struct re_guts *g, const char *string, size_t nmatch,
 	const char *stop;
 
 	/* simplify the situation where possible */
-	if (g->cflags&REG_NOSUB)
+        if (!string)
----------------
tanmaysachan wrote:

I can move this to the function calling llvmregexec() within Regex.cpp ? Since the regex engine should be able to discard null strings as match-less for any regex.

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


More information about the llvm-commits mailing list