From ddabeabadf8f5f7ef7fa3d60440f449b543d2bb4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 11 Nov 2026 10:19:49 +0100 Subject: [PATCH] DPL: do not use an attribute value the query parser failed to read When the value of a query attribute was empty, e.g. "x:TST/A1/0?lifetime=", assignLastStringMatch pushed the error state and returned without setting currentValue, but IN_END_VALUE went on to read *currentValue, which was unset. The DataQuery test crashed on this with GCC 15. Stop at the error, merge the three identical branches, and reset the attribute key and value for each ;-separated query like the rest of the per-query state. --- .../Core/src/DataDescriptorQueryBuilder.cxx | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/Framework/Core/src/DataDescriptorQueryBuilder.cxx b/Framework/Core/src/DataDescriptorQueryBuilder.cxx index f9183435447c2..f6f07d2fd9d26 100644 --- a/Framework/Core/src/DataDescriptorQueryBuilder.cxx +++ b/Framework/Core/src/DataDescriptorQueryBuilder.cxx @@ -207,6 +207,8 @@ std::vector DataDescriptorQueryBuilder::parse(char const* config) currentDescription.reset(); currentSubSpec.reset(); currentTimeModulo.reset(); + currentKey.reset(); + currentValue.reset(); pushState(IN_BEGIN_BINDING); } break; case IN_BEGIN_BINDING: { @@ -322,41 +324,26 @@ std::vector DataDescriptorQueryBuilder::parse(char const* config) token(IN_STRING, "&;"); } break; case IN_END_VALUE: { + QueryBuilderState nextState; if (*next == '&') { - assignLastStringMatch("value", 1000, currentValue, IN_BEGIN_KEY); - if (*currentKey == "lifetime" && currentValue == "condition") { - currentLifetime = Lifetime::Condition; - } - if (*currentKey == "ccdb-run-dependent") { - int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue)); - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}}); - } else { - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}}); - } - } else if (*next == ';') { - assignLastStringMatch("value", 1000, currentValue, IN_END_ATTRIBUTES); - if (*currentKey == "lifetime" && currentValue == "condition") { - currentLifetime = Lifetime::Condition; - } - if (*currentKey == "ccdb-run-dependent") { - int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue)); - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}}); - } else { - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}}); - } - } else if (*next == '\0') { - assignLastStringMatch("value", 1000, currentValue, IN_END_ATTRIBUTES); - if (*currentKey == "lifetime" && currentValue == "condition") { - currentLifetime = Lifetime::Condition; - } - if (*currentKey == "ccdb-run-dependent") { - int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue)); - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}}); - } else { - attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}}); - } + nextState = IN_BEGIN_KEY; + } else if (*next == ';' || *next == '\0') { + nextState = IN_END_ATTRIBUTES; } else { error("missing value for string value"); + continue; + } + if (!assignLastStringMatch("value", 1000, currentValue, nextState)) { + continue; // The error is pushed and currentValue is not set. + } + if (*currentKey == "lifetime" && currentValue == "condition") { + currentLifetime = Lifetime::Condition; + } + if (*currentKey == "ccdb-run-dependent") { + int val = currentValue == "false" ? 0 : (currentValue == "true" ? 1 : std::stoi(*currentValue)); + attributes.push_back(ConfigParamSpec{*currentKey, VariantType::Int, val, {}}); + } else { + attributes.push_back(ConfigParamSpec{*currentKey, VariantType::String, *currentValue, {}}); } } break; case IN_END_ATTRIBUTES: {