Issue:AiSee crash due to several near edges
From FollowTheScore
Description: | there are several constellations of nearedges and bentnearedges which lead to a program crash |
Extension / Version: | aiSee / 2.2 |
Type / Status: | Bug / open |
Problem
The following graph definition causes a memory violation:
graph: { title: "A" rightnearedge: { source:"A" target:"B" } leftnearedge: { source:"A" target:"C" } rightbentnearedge: { source:"A" target:"D" } }
There are more constellations which have the same effect. The following piece of php code tries to identify all dangerous constellations:
foreach ($edges as $edgeId => $edge) { $n=$ln=$rn=$b=$lb=$rb=0; $edgeKind = $edge['kind']; if ($edgeKind == 'near') $n++; else if ($edgeKind == 'leftnear') $ln++; else if ($edgeKind == 'rightnear') $rn++; else if ($edgeKind == 'bentnear') $b++; else if ($edgeKind == 'leftbentnear') $lb++; else if ($edgeKind == 'rightbentnear') $rb++; foreach ($edges as $nEdgeId => $nEdge) { $from = $edge['source']; if ($nEdgeId <= $edgeId || $nEdge['source'] != $from) continue; if ($nEdge['target'] == $edge['target']) { $this->error("near edges at '$from' point to the same other node '".$edge['target'],''); } $nEdgeKind = $nEdge['kind']; if ($nEdgeKind == 'near') $n++; else if ($nEdgeKind == 'leftnear') $ln++; else if ($nEdgeKind == 'rightnear') $rn++; else if ($nEdgeKind == 'bentnear') $b++; else if ($nEdgeKind == 'leftbentnear') $lb++; else if ($nEdgeKind == 'rightbentnear') $rb++; //$this->parser->errorText .= "checking $edgeKind edge $edgeId against $nEdgeKind edge $nEdgeId at $from: $n,$ln,$rn $b,$lb,$rb:\n"; if (($rn+$ln>=2 && $rb+$lb>=1) ) $this->error("too many near (bent) edges at '$from'",''); } }
Reply
Fixed in aiSee 3.0. We'll see if we can fix it for aiSee 2.2.x, too. --Schwallex 15:46, 14 November 2007 (CET)