1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-10 19:14:57 +02:00
* ObjectManipulator.cpp (ObjectManipulator::findWhereUsedRecursively):
fixed bug #2800625 "recursive groups cause infinite loop and crash
in compiler". When a group included itself, compiler used to go
into infinite loop and crash. The fix in this function also takes
care of the situation when group A referenced group B, which in
turn referenced group A again.
This commit is contained in:
Vadim Kurland
2009-06-03 18:24:14 +00:00
parent 1c0c8b2010
commit 9ac1a7801b
3 changed files with 21 additions and 7 deletions

View File

@@ -1 +1 @@
#define BUILD_NUM 991
#define BUILD_NUM 1030

View File

@@ -1,3 +1,12 @@
2009-06-03 vadim <vadim@vk.crocodile.org>
* ObjectManipulator.cpp (ObjectManipulator::findWhereUsedRecursively):
fixed bug #2800625 "recursive groups cause infinite loop and crash
in compiler". When a group included itself, compiler used to go
into infinite loop and crash. The fix in this function also takes
care of the situation when group A referenced group B, which in
turn referenced group A again.
2009-06-01 vadim <vadim@vk.crocodile.org>
* newHostDialog.cpp (newHostDialog::selectedInterface): fixed the

View File

@@ -3211,11 +3211,19 @@ void ObjectManipulator::findWhereUsedRecursively(FWObject *obj,
obj->getName().c_str(), obj->getTypeName().c_str());
set<FWObject*> resset_tmp;
set<FWObject*> resset_tmp2;
/*
* findWhereObjectIsUsed() finds references to object 'obj' in a subtree
* rooted at object 'top'.
*/
m_project->db()->findWhereObjectIsUsed(obj, top, resset_tmp);
set<FWObject *>::iterator i = resset.begin();
for ( ; i!=resset.end(); ++i)
if (resset_tmp.count(*i)) resset_tmp.erase(*i);
set<FWObject *>::iterator i = resset_tmp.begin();
resset.insert(resset_tmp.begin(), resset_tmp.end());
i = resset_tmp.begin();
for ( ; i!=resset_tmp.end(); ++i)
{
FWObject *parent_obj = *i;
@@ -3226,11 +3234,8 @@ void ObjectManipulator::findWhereUsedRecursively(FWObject *obj,
// add new results to a separate set to avoid modifying the resset_tmp
// in the middle of iteration
if (Group::cast(parent_obj) && !RuleElement::cast(parent_obj))
findWhereUsedRecursively(parent_obj, top, resset_tmp2);
findWhereUsedRecursively(parent_obj, top, resset);
}
resset.insert(resset_tmp.begin(), resset_tmp.end());
resset.insert(resset_tmp2.begin(), resset_tmp2.end());
}
list<Firewall *> ObjectManipulator::findFirewallsForObject(FWObject *o)