DiscussionsIssue archiveOCCT:Application Framework

Archived issue #0003513

There is no check for boundary of array in method Set for array attributes

Open CASCADEOCCT:Application Frameworkclosed6 public notes

Search issues

Description

In methods Set of TDataStd_RealArray and TDataStd_IntegerArray there are no
check for boundary of arrays. So if new array is set on the same label method
Set will return the array with previous boundaries.

Additional information

The next documentation note is added to 'Set (indx, value)' methods of classes holding arrays (cdl description):
"'OutOfRange' exception is raised if <Index> doesn't respect Lower or Upper bounds of the internal array.":
- TDataStd_ByteArray.cdl,
- TDataStd_BooleanArray.cdl,
- TDataStd_ExtStringArray.cdl,
- TDataStd_IntegerArray.cdl,
- TDataStd_RealArray.cdl,
- TDataStd_ReferenceArray.cdl.

Public activity

6 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Fixed.
Ready for reviewing.
02Commenter 2
Branch CR3513
03Commenter 2
Reviewed!
04Commenter 3
> -const TCollection_ExtendedString& TDataStd_ExtStringArray::Value (const Standard_Integer index) const 
> +TCollection_ExtendedString TDataStd_ExtStringArray::Value (const Standard_Integer index) const 

I suppose these changes unrelated to the bug description should be treated as:
- please use TDataStd_ExtStringArray::Array() to access stored strings without copying and have a lot/huge strings
- please port your code if you have accidentally used constructions like const TCollection_ExtendedString& aValue = aData->Value (theIndex);
05Commenter 5
The referred modification rather is a misprint as it is not supposed to be done.
Fixed.

06Commenter 6
Dear Commenter 1,

Branch CR3513 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 953 (953 on master)
Windows: 959 (958 on master)

products component :
Linux: 189 (189 on master)
Windows: 288 (288 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 363934896 / 363701960
Total CPU difference: 48561.00000000113 / 45479.55000000069

Testing on Windows:
Total MEMORY difference: 363934896 / 363701960
Total CPU difference: 48561.00000000113 / 45479.55000000069

There are not differences in images found by testdiff.