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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 12:41:25 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)
----------------
nikic wrote:

I don't think this code considers NULL string to be a valid input. I think this fix has to be in some caller higher up.

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


More information about the llvm-commits mailing list