fix regex reading from freed memory (fixes #197)
This commit is contained in:
@@ -204,7 +204,8 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) {
|
||||
if (data->Application.has_value()) {
|
||||
static const auto regex = Glib::Regex::create(R"(</(.*?):(\d+)>)");
|
||||
Glib::MatchInfo match;
|
||||
if (regex->match(data->Content, match)) {
|
||||
Glib::ustring string = data->Content;
|
||||
if (regex->match(string, match)) {
|
||||
const auto cmd = match.fetch(1);
|
||||
const auto app = data->Application->Name;
|
||||
b->insert_markup(s, "<i>used <span color='#697ec4'>" + cmd + "</span> with " + app + "</i>");
|
||||
|
@@ -54,7 +54,8 @@ std::optional<uint32_t> GetBuildNumberFromJSURL(const Glib::ustring &url, const
|
||||
|
||||
auto regex = Glib::Regex::create(R"("buildNumber",null!==\(t="(\d+)\"\))");
|
||||
Glib::MatchInfo match;
|
||||
if (regex->match(res.text, match)) {
|
||||
Glib::ustring string = res.text;
|
||||
if (regex->match(string, match)) {
|
||||
const auto str_value = match.fetch(1);
|
||||
try {
|
||||
return std::stoul(str_value);
|
||||
|
Reference in New Issue
Block a user