From 670fdb0847931379adb995028fcfda058a6cb35a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse Date: Fri, 4 Oct 2019 14:26:42 +0200 Subject: [PATCH] DPL: fix use after free in TextControlService --- .../Core/include/Framework/TextControlService.h | 3 +-- Framework/Core/src/TextControlService.cxx | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Framework/Core/include/Framework/TextControlService.h b/Framework/Core/include/Framework/TextControlService.h index 99b6437d0a5af..6fb176f5c5518 100644 --- a/Framework/Core/include/Framework/TextControlService.h +++ b/Framework/Core/include/Framework/TextControlService.h @@ -12,7 +12,6 @@ #include "Framework/ControlService.h" #include -#include #include namespace o2 @@ -44,7 +43,7 @@ class TextControlService : public ControlService bool mOnce = false; }; -bool parseControl(std::string_view s, std::smatch& match); +bool parseControl(std::string const& s, std::smatch& match); } // namespace framework } // namespace o2 diff --git a/Framework/Core/src/TextControlService.cxx b/Framework/Core/src/TextControlService.cxx index f24e33d37a189..9eedf33d125e2 100644 --- a/Framework/Core/src/TextControlService.cxx +++ b/Framework/Core/src/TextControlService.cxx @@ -33,16 +33,10 @@ void TextControlService::readyToQuit(bool all) } } -bool parseControl(std::string_view s, std::smatch& match) +bool parseControl(std::string const& s, std::smatch& match) { - const static std::regex controlRE("READY_TO_(QUIT)_(ME|ALL)", std::regex::optimize); - auto idx = s.find("CONTROL_ACTION: "); - if (idx == std::string::npos) { - return false; - } - s.remove_prefix(idx); - std::string rs{s}; - return std::regex_search(rs, match, controlRE); + const static std::regex controlRE(".*CONTROL_ACTION: READY_TO_(QUIT)_(ME|ALL)", std::regex::optimize); + return std::regex_search(s, match, controlRE); } } // namespace framework