Mesa (master): anv: avoid segmentation fault due to vk_error()
Samuel Iglesias Gonsálvez
samuelig at kemper.freedesktop.org
Fri Jan 19 08:53:00 UTC 2018
Module: Mesa
Branch: master
Commit: 7109a1fe132e5f79a25bb34f0f28a21cce3076db
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7109a1fe132e5f79a25bb34f0f28a21cce3076db
Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date: Fri Jan 19 08:45:10 2018 +0100
anv: avoid segmentation fault due to vk_error()
vk_error() is a macro that calls __vk_errorf() with instance == NULL.
Then, __vk_errorf() passes a pointer to instance->debug_report_callbacks
to vk_debug_error(), which segfaults as this pointer is invalid but not
NULL.
Fixes: e5b1bd6ab8 "vulkan: move anv VK_EXT_debug_report implementation to common code."
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
---
src/intel/vulkan/anv_util.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c
index 6b31224d7f..3c1803aa05 100644
--- a/src/intel/vulkan/anv_util.c
+++ b/src/intel/vulkan/anv_util.c
@@ -99,14 +99,16 @@ __vk_errorf(struct anv_instance *instance, const void *object,
snprintf(report, sizeof(report), "%s:%d: %s", file, line, error_str);
}
- vk_debug_report(&instance->debug_report_callbacks,
- VK_DEBUG_REPORT_ERROR_BIT_EXT,
- type,
- (uint64_t) (uintptr_t) object,
- line,
- 0,
- "anv",
- report);
+ if (instance) {
+ vk_debug_report(&instance->debug_report_callbacks,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ type,
+ (uint64_t) (uintptr_t) object,
+ line,
+ 0,
+ "anv",
+ report);
+ }
intel_loge("%s", report);
More information about the mesa-commit
mailing list