summaryrefslogtreecommitdiff
path: root/libc/src/string/strstr.cpp
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2025-06-08 17:43:02 -0700
committerAmir Ayupov <aaupov@fb.com>2025-06-08 17:43:02 -0700
commit68b99df7ad1b910378c8cda5afff637fbe3c0efc (patch)
tree1d2e51419c3f89a0909603d355598c27f1a92d42 /libc/src/string/strstr.cpp
parentbbbecc425389aeb7b93d9018b40a95b389c27f40 (diff)
parentc480dcddd91e3ff0707d6629e6ddac8587d9d1f1 (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/aaupov/spr/main.bolt-sort-entrydata
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'libc/src/string/strstr.cpp')
-rw-r--r--libc/src/string/strstr.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/src/string/strstr.cpp b/libc/src/string/strstr.cpp
index 5132f06ef53f..44797ef670b9 100644
--- a/libc/src/string/strstr.cpp
+++ b/libc/src/string/strstr.cpp
@@ -10,6 +10,7 @@
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
#include "src/string/memory_utils/inline_strstr.h"
namespace LIBC_NAMESPACE_DECL {
@@ -18,6 +19,8 @@ namespace LIBC_NAMESPACE_DECL {
// improved upon using well known string matching algorithms.
LLVM_LIBC_FUNCTION(char *, strstr, (const char *haystack, const char *needle)) {
auto comp = [](char l, char r) -> int { return l - r; };
+ LIBC_CRASH_ON_NULLPTR(haystack);
+ LIBC_CRASH_ON_NULLPTR(needle);
return inline_strstr(haystack, needle, comp);
}