From 813c1e8981893c11e118b19c125d6bc282f51765 Mon Sep 17 00:00:00 2001 From: NZKea <20099289+NZKea@users.noreply.github.com> Date: Thu, 30 Apr 2026 09:52:45 +1200 Subject: [PATCH] FormatUtils: null-check drmGetFormatModifierName result (#287) drmGetFormatModifierName() can return NULL for DRM modifiers that libdrm has no human-readable name for (notably Apple Silicon / Asahi GPU vendor-specific modifiers). drmModifierToName() then constructs a std::string from the NULL pointer and aborts with `std::logic_error: basic_string: construction from null is not valid`, crashing any client that triggers a swapchain reconfigure against an Asahi GBM buffer. Mirror the existing NULL handling in fourccToName() (which already falls back to "unknown") to avoid the abort. Co-authored-by: Claude Opus 4.7 --- src/utils/FormatUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/FormatUtils.cpp b/src/utils/FormatUtils.cpp index 17c568d6..29410421 100644 --- a/src/utils/FormatUtils.cpp +++ b/src/utils/FormatUtils.cpp @@ -12,7 +12,7 @@ std::string fourccToName(uint32_t drmFormat) { std::string drmModifierToName(uint64_t drmModifier) { auto n = drmGetFormatModifierName(drmModifier); - std::string name = n; + std::string name = n ? n : "unknown"; free(n); // NOLINT(cppcoreguidelines-no-malloc,-warnings-as-errors) return name; }