From dcf6e7432d4f502d2443ccc051031d34d99dcce4 Mon Sep 17 00:00:00 2001 From: Christian Kreibich Date: Thu, 10 Apr 2025 16:33:26 -0700 Subject: [PATCH] Bugfix: AsString() on an EnumVal will segfault This likely simply hasn't come up in practice, but we now go the intended route of producing the textual enum value from the type. --- src/plugin/ComponentManager.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin/ComponentManager.h b/src/plugin/ComponentManager.h index 016623069c..89b9efe976 100644 --- a/src/plugin/ComponentManager.h +++ b/src/plugin/ComponentManager.h @@ -267,7 +267,8 @@ const std::string& ComponentManager::GetComponentName(EnumValPtr val) const { if ( C* c = Lookup(val.get()) ) return c->CanonicalName(); - reporter->InternalWarning("requested name of unknown component tag %s", val->AsString()->CheckString()); + reporter->InternalWarning("requested name of unknown component tag %s", + val->GetType()->AsEnumType()->Lookup(val->Get())); return error; } @@ -295,7 +296,8 @@ StringValPtr ComponentManager::GetComponentNameVal(EnumValPtr val) const { if ( C* c = Lookup(val.get()) ) return c->CanonicalNameVal(); - reporter->InternalWarning("requested name of unknown component tag %s", val->AsString()->CheckString()); + reporter->InternalWarning("requested name of unknown component tag %s", + val->GetType()->AsEnumType()->Lookup(val->Get())); return error; }