[compiler-rt] Fix possible underflow in ParseAndSetPath (PR #159389)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 09:10:26 PDT 2025


================
@@ -106,6 +106,7 @@ static void ParseAndSetPath(const char *pattern, char *dest,
                             const uptr dest_size) {
   CHECK(pattern);
   CHECK(dest);
+  CHECK_NE(internal_strcmp(pattern, ""), 0);
   CHECK_GE(dest_size, 1);
   dest[0] = '\0';
----------------
ellishg wrote:

Instead of crashing on the empty string, I think it's better to simply return here so that dest becomes "".

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


More information about the llvm-commits mailing list