diff --git a/util/custom_allocator.hpp b/util/custom_allocator.hpp index bb6a7a0..486fd18 100644 --- a/util/custom_allocator.hpp +++ b/util/custom_allocator.hpp @@ -316,7 +316,7 @@ public: base::push_back(std::forward(args)...); return true; } - catch (const std::bad_alloc &e) + catch (const std::bad_alloc &) { return false; } @@ -348,11 +348,11 @@ public: base::resize(std::forward(args)...); return true; } - catch (const std::bad_alloc &e) + catch (const std::bad_alloc &) { return false; } } }; -} /* namespace util */ \ No newline at end of file +} /* namespace util */ diff --git a/util/extension_list.cpp b/util/extension_list.cpp index a3e672b..4194404 100644 --- a/util/extension_list.cpp +++ b/util/extension_list.cpp @@ -48,6 +48,11 @@ VkResult extension_list::add(const char *const *extensions, uint32_t count) { auto &dst = m_ext_props[initial_size + i]; strncpy(dst.extensionName, extensions[i], sizeof(dst.extensionName)); + + if (strlen(extensions[i]) >= sizeof(dst.extensionName)) + { + dst.extensionName[sizeof(dst.extensionName) - 1] = '\0'; + } } return VK_SUCCESS; } diff --git a/wsi/wsi_factory.cpp b/wsi/wsi_factory.cpp index 0a85a15..8b8b86a 100644 --- a/wsi/wsi_factory.cpp +++ b/wsi/wsi_factory.cpp @@ -154,6 +154,11 @@ VkResult add_extensions_required_by_layer(VkPhysicalDevice phys_dev, const util: util::extension_list extensions_required_by_layer{allocator}; surface_properties *props = get_surface_properties(wsi_ext.platform); + if (props == nullptr) + { + return VK_ERROR_INITIALIZATION_FAILED; + } + res = props->get_required_device_extensions(extensions_required_by_layer); if (res != VK_SUCCESS) { @@ -197,7 +202,13 @@ PFN_vkVoidFunction get_proc_addr(const char *name) */ for (const auto &wsi_ext : supported_wsi_extensions) { - PFN_vkVoidFunction func = get_surface_properties(wsi_ext.platform)->get_proc_addr(name); + surface_properties *props = get_surface_properties(wsi_ext.platform); + if (props == nullptr) + { + return nullptr; + } + + PFN_vkVoidFunction func = props->get_proc_addr(name); if (func) { return func;