Vulkan: Don't crash on diagnostics with null pMessageIdName
This can be null and this will causes a crash in strstr(). Check for null
before dereferencing this field.
BUG=angleproject:2475
TEST=angle_end2end_tests on Fuchsia and angle_enable_vulkan_validation_layers=true
Change-Id: I76a2738365838cb2f9cb54af7637417735762b69
Reviewed-on: https://chromium-review.googlesource.com/c/1446506
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index 57f7808..4d7411d 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -112,6 +112,10 @@
// return "true" if given code/prefix/message is known, else return "false"
bool IsIgnoredDebugMessage(const char *message)
{
+ if (!message)
+ {
+ return false;
+ }
for (const char *msg : kSkippedMessages)
{
if (strstr(message, msg) != nullptr)
@@ -230,7 +234,11 @@
}
std::ostringstream log;
- log << "[ " << callbackData->pMessageIdName << " ] " << callbackData->pMessage << std::endl;
+ if (callbackData->pMessageIdName)
+ {
+ log << "[ " << callbackData->pMessageIdName << " ] ";
+ }
+ log << callbackData->pMessage << std::endl;
// Aesthetic value based on length of the function name, line number, etc.
constexpr size_t kStartIndent = 28;