Skip to content

Commit

Permalink
ConfigItem: Fix infinite recursion caused by ignore_on_error when c…
Browse files Browse the repository at this point in the history
…ommitting an item

When committing an item with `ignore_on_error` flag set fails, the `Commit()` method only returns `nullptr`
and the current item is not being dropped from `m_Items`. `CommittNewItems()` also doesn't check the return
value of `Commit()` but just continues and tries to commit all items from `m_Items` in recursive call. Since
this corrupt item is never removed from `m_Items`, it ends up in an endless recursion till it finally crashes.
  • Loading branch information
yhabteab committed Oct 12, 2022
1 parent 91cbb85 commit f7298e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/config/configitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,14 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
if (item->m_Type != type)
return;

ip.first->Commit(ip.second);
if (!item->Commit(ip.second)) {
if (item->IsIgnoreOnError()) {
item->Unregister();
}

return;
}

committed_items++;
});

Expand Down

0 comments on commit f7298e8

Please sign in to comment.