Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-11-02 17:07:35 +0300
committerJacques Lucke <jacques@blender.org>2021-11-02 17:07:50 +0300
commit698b05fc58f65ffe997fd18958c7d075277021d7 (patch)
tree1adbb660216a1dc0b3c82b44348f0a4457bd7bda
parentefcf36f2e9773f30fa6d4cce8fd0e793b9694b78 (diff)
BLI: avoid passing nullptr to strncmp
This resulted in an ASAN warning.
-rw-r--r--source/blender/blenlib/BLI_string_ref.hh4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh
index 34baf94c448..dc73208350f 100644
--- a/source/blender/blenlib/BLI_string_ref.hh
+++ b/source/blender/blenlib/BLI_string_ref.hh
@@ -610,6 +610,10 @@ constexpr bool operator==(StringRef a, StringRef b)
if (a.size() != b.size()) {
return false;
}
+ if (a.data() == b.data()) {
+ /* This also avoids passing null to the call below, which would results in an ASAN warning. */
+ return true;
+ }
return STREQLEN(a.data(), b.data(), (size_t)a.size());
}