View Issue Details

IDProjectCategoryView StatusLast Update
0007602CTT UA Scripts1 - Script Issuepublic2022-09-09 15:58
ReporterElliot Gawthrop Assigned ToYannik Klaass  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.03.501 
Summary0007602: GetReferenceTypeSubtypes incorrectly protects against stack overflow - preventing test case from running
Description

The GetReferenceTypeSubtypes function inside ViewServiceSet/Browse/get_references.js attempts to protect against a stack-overflow by incrementing a level variable each time the function is recursively called, and prematurely ends the test if the level exceeds 12.

This has been implemented incorrectly as line 280 calls ++level while iterating through sibling references of a node. So if the function browses a node that contains N references, and each of those references has zero subtypes, after each of the references has been iterated through the level variable will now be set to N. This is wrong - because the call stack is still on the first level.

Instead of ++level, I believe the code should be level + 1 when calling the function recursively. This will mean the level will increase when building up the callstack, and then decrease when frames are popped from the stack.

Steps To Reproduce
  1. Set Has References of a ReferenceType and SubType to a node that has two references where one is the subtype of the other.
  2. Ensure there are > 12 sibling reference types of the subtype reference (see attached picture)
  3. Run View Basic / 005.js
Additional Information

The node under test has references HasComponent and HasAlarm. Note that in the attached picture, at no point is there 12 levels of recursion.

TagsNo tags attached.
Attached Files
References.png (10,820 bytes)   
References.png (10,820 bytes)   
Files Affected

Activities

Paul Hunkar

2022-02-24 15:54

administrator   ~0016091

from the description of the issue, this appears to be a valid issue, with a valid suggested solution, but the code will have to be checked.

Yannik Klaass

2022-09-05 13:21

developer   ~0017519

Code checked with suggested solution, which is correct. Changed '++level' to 'level + 1'.

Paul Hunkar

2022-09-09 15:58

administrator   ~0017595

review changes in call, agreed to updates and closed

Issue History

Date Modified Username Field Change
2022-01-18 12:07 Elliot Gawthrop New Issue
2022-01-18 12:07 Elliot Gawthrop File Added: References.png
2022-02-24 15:52 Paul Hunkar Assigned To => Alexander Allmendinger
2022-02-24 15:52 Paul Hunkar Status new => assigned
2022-02-24 15:54 Paul Hunkar Note Added: 0016091
2022-08-02 20:04 Paul Hunkar Project Compliance Test Tool (CTT) Unified Architecture => CTT UA Scripts
2022-09-05 13:21 Yannik Klaass Assigned To Alexander Allmendinger => Yannik Klaass
2022-09-05 13:21 Yannik Klaass Status assigned => resolved
2022-09-05 13:21 Yannik Klaass Resolution open => fixed
2022-09-05 13:21 Yannik Klaass Note Added: 0017519
2022-09-09 15:58 Paul Hunkar Status resolved => closed
2022-09-09 15:58 Paul Hunkar Fixed in Version => 1.03.501
2022-09-09 15:58 Paul Hunkar Note Added: 0017595