Skip to content

Commit 4eebc84

Browse files
author
Sriya Pratipati
committed
Added nullptr handling to wmemcmp
1 parent dcf9b4f commit 4eebc84

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libc/src/wchar/wmemcmp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
1414
#include "src/__support/macros/config.h"
15+
#include "src/__support/macros/null_check.h" // LIBC_CRASH_ON_NULLPTR
1516

1617
namespace LIBC_NAMESPACE_DECL {
1718

1819
LLVM_LIBC_FUNCTION(int, wmemcmp,
1920
(const wchar_t *s1, const wchar_t *s2, size_t n)) {
21+
LIBC_CRASH_ON_NULLPTR(s1);
22+
LIBC_CRASH_ON_NULLPTR(s2);
2023
for (size_t i = 0; i < n; ++i) {
2124
if (s1[i] != s2[i])
2225
return (int)(s1[i] - s2[i]);

0 commit comments

Comments
 (0)