MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0022554Open CASCADE[OCCT] OCCT:Visualizationpublic2011-05-31 15:012012-03-29 17:26
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeveritytrivial 
StatusclosedResolutionfixed 
PlatformOSAllOS Version
Product Version[OCCT] 6.5.0 
Target Version[OCCT] 6.5.3Fixed in Version[OCCT] 6.5.3 
Summary0022554: Application hangs on selection
DescriptionIn method Standard_Real Select3D_SensitiveCurve::ComputeDepth(),
(Select3D_Pnt*)mypolyg3d accessed without out-of-range check (mylastseg+1 can
be equal to mynbpoints).
If happens - this cause undefined behaviour or even application hang (if
values interpreted as QNAN).

In class Select3D_SensitivePoly fields mypolyg3d and mypolyg2d declared and
managed in unsafe manner. This cause potential errors in other places where
these arrays are used.
Additional information
and documentation updates
Added entities:

Select3D_PointData.hxx – implemented class Select3D_PointData for safe management of Select3D_SensitivePoly polygons of 3D and 2D points.

Modified entities:

Select3D_SensitivePoly.cdl :
Added new member Select3D_PointData mypolyg instead of members mypolyg3d, mypolyg2d, mynbpoints. Removed method Destroy().

Modified all methods that used old members mypolyg3d, mypolyg2d, mynbpoints in the following files:
Select3D_SensitiveCircle.cxx
Select3D_SensitiveCurve.cxx
Select3D_SensitiveFace.cxx
Select3D_SensitivePoly.cxx
Select3D_SensitivePoly.lxx
Select3D_SensitiveTriangle.cxx


ViewerTest_ObjectCommands.cxx:

Added two new classes Triangle and SegmentObject based on AIS_InteractiveObject.
Added two new DRAW commands vtriangle and vsegment. All of them – for test Select3D_SensitiveTriangle and Select3D_SensitiveCurve.
 
thug.doc :

Added description of new DRAW commands vtriangle and vsegment.
TagsNo tags attached.
Test case numberTest cases chl 934 T7 T8 T9 U1
Attached Files? file icon vcircle.tcl (120 bytes) 2012-02-03 11:56
? file icon vplane.tcl (118 bytes) 2012-02-03 11:57
? file icon vsegment.tcl (95 bytes) 2012-02-03 11:57
? file icon vtriangle.tcl (123 bytes) 2012-02-03 11:57
gz file icon chl_934_T7_T8_T9_U1.tar.gz (453 bytes) 2012-02-22 17:16

- Relationships
related to 0012121closedbugmaster Optimization of existing selection classes 

-  Notes
(0019333)
san (developer)
2012-02-01 16:42
edited on: 2012-02-01 16:42

This issue was suspended till integration of the patch for 0012121.
Now that the patch is in the trunk, this issue has been unblocked, so please proceed with its correction.

(0019372)
aaa (developer)
2012-02-03 11:34

SVN branch http://svn/svn/occt/branches/OCC22554 [^] is ready for reviewing
(0019373)
aaa (developer)
2012-02-03 12:00

Files added :
vcircle.tcl
vplane.tcl
vsegment.tcl
vtriangle.tcl

Test scripts display circle, plane, segment and triangle. Selection and highlighting for these objects should work as usual.
(0019392)
kgv (developer)
2012-02-03 17:46
edited on: 2012-02-03 18:03

> Select3D_SensitivePoly(const Handle(SelectBasics_EntityOwner)& OwnerId,
> const TColgp_Array1OfPnt& ThePoints)
> : Select3D_SensitiveEntity(OwnerId),
> mypolyg(ThePoints.Upper()-ThePoints.Lower()+1)
> {
> if (!mypolyg.IsValid())
> return;
This validation is performed in all constructors and class methods!
And looks like checking (this != NULL).
There are 2 questions:
- is this solution has benefits against behavior used in OCCT to throw exception in constructor when incorrect data is passed?
- is it really happens (if not - then it is better to throw exception to indicate really invalid situation)?

Comments in new header file 'Select3D_PointData.hxx' doesn't corresponds to OCCT coding rules. This is also bad practice to clarify class with constructor and destructor with 'struct' keyword.

Select3D_SensitivePoly.lxx, 6
> inline void Select3D_SensitivePoly
> ::Points3D( Handle(TColgp_HArray1OfPnt)& theHArrayOfPnt )
> {
> Standard_Integer aSize = mypolyg.Size();
> theHArrayOfPnt = new TColgp_HArray1OfPnt(1,aSize);
> for(Standard_Integer i = 1; i <= aSize; i++)
> {
> gp_Pnt aPnt;
>> if(mypolyg.Pnt(i-1, aPnt)) /// ????
> theHArrayOfPnt->SetValue(i, aPnt);
> }
> }
how this condition may fail if cycle limited to mypolyg.Size()?

(0019424)
aaa (developer)
2012-02-07 11:45

SVN branch http://svn/svn/occt/branches/OCC22554 [^] is ready for reviewing
(0019460)
san (developer)
2012-02-08 14:47

The branch reviewed with the following remarks:

Select3D_SensitiveCircle class
====================================
Standard_Boolean Select3D_SensitiveCircle::
Matches(const Standard_Real X,
        const Standard_Real Y,
        const Standard_Real aTol,
        Standard_Real& DMin)

The case when mypolyg.Size() == 1 (a circle degenerated down to a point) is not treated, though it is possible according to constructors.
Corresponding code to be added similalry to Select3D_SensitivePoint::Matches().

In general, please check that Matches() methods do not return Standard_True when something wrong happens.
Otherwise, myDetectedIndex might be invalid but ComputeDepth() will be called that uses it.

ComputeDepth() should return Precision::Infinite() if something goes wrong - see Select3D_SensitiveCurve::ComputeDepth().

(0019508)
aaa (developer)
2012-02-10 14:49

SVN branch http://svn/svn/occt/branches/OCC22554 [^] is ready for reviewing
(0019664)
san (developer)
2012-02-20 13:16

The branch OCC22554 reviewed without remarks and is ready for testing.
(0019708)
mkv (tester)
2012-02-21 19:52

Dear BugMaster,
Workbench KAS:dev:mkv-22554-occt was created from SVN branch http://svn/svn/occt/branches/OCC22554 [^]
(and mkv-22554-products from trunk) and compiled on Linux platform.

There are not regressions in mkv-22554-products regarding to KAS:dev:products-20120217-opt

See results in /QADisk/occttests/results/KAS/dev/mkv-22554-products_20022012/lin
See reference results in /QADisk/occttests/results/KAS/dev/products-20120217-opt_17022012/lin
See test cases in /QADisk/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://doc/doku.php?id=occt:certification [^]
(0019745)
bugmaster (administrator)
2012-02-22 17:06

Integrated into trunk of occt repository

Date: 2012-02-22 17:01:33 +0400 (Wed, 22 Feb 2012)
New Revision: 10603

Added:
   trunk/src/Select3D/Select3D_PointData.hxx
Modified:
   trunk/src/Select3D/FILES
   trunk/src/Select3D/Select3D.cdl
   trunk/src/Select3D/Select3D_SensitiveCircle.cdl
   trunk/src/Select3D/Select3D_SensitiveCircle.cxx
   trunk/src/Select3D/Select3D_SensitiveCurve.cdl
   trunk/src/Select3D/Select3D_SensitiveCurve.cxx
   trunk/src/Select3D/Select3D_SensitiveFace.cdl
   trunk/src/Select3D/Select3D_SensitiveFace.cxx
   trunk/src/Select3D/Select3D_SensitivePoly.cdl
   trunk/src/Select3D/Select3D_SensitivePoly.cxx
   trunk/src/Select3D/Select3D_SensitivePoly.lxx
   trunk/src/Select3D/Select3D_SensitiveTriangle.cdl
   trunk/src/Select3D/Select3D_SensitiveTriangle.cxx
   trunk/src/ViewerTest/ViewerTest_ObjectCommands.cxx

- Related Changesets
occt: master ceae62f0
Timestamp: 2012-02-22 13:01:33
Author: aaa
Committer: bugmaster
Details ] Diff ]
0022554: Application hangs on selection
mod - src/Select3D/FILES Diff ] File ]
mod - src/Select3D/Select3D.cdl Diff ] File ]
add - src/Select3D/Select3D_PointData.hxx Diff ] File ]
mod - src/Select3D/Select3D_SensitiveCircle.cdl Diff ] File ]
mod - src/Select3D/Select3D_SensitiveCircle.cxx Diff ] File ]
mod - src/Select3D/Select3D_SensitiveCurve.cdl Diff ] File ]
mod - src/Select3D/Select3D_SensitiveCurve.cxx Diff ] File ]
mod - src/Select3D/Select3D_SensitiveFace.cdl Diff ] File ]
mod - src/Select3D/Select3D_SensitiveFace.cxx Diff ] File ]
mod - src/Select3D/Select3D_SensitivePoly.cdl Diff ] File ]
mod - src/Select3D/Select3D_SensitivePoly.cxx Diff ] File ]
mod - src/Select3D/Select3D_SensitivePoly.lxx Diff ] File ]
mod - src/Select3D/Select3D_SensitiveTriangle.cdl Diff ] File ]
mod - src/Select3D/Select3D_SensitiveTriangle.cxx Diff ] File ]
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-10-07 17:28 san Assigned To bugmaster => aaa
2011-10-07 17:28 san Status new => assigned
2012-02-01 16:40 san Relationship added related to 0012121
2012-02-01 16:42 san Note Added: 0019333
2012-02-01 16:42 san Note Edited: 0019333 View Revisions
2012-02-03 11:31 aaa Fixed in Version EMPTY =>
2012-02-03 11:31 aaa Description Updated View Revisions
2012-02-03 11:31 aaa Additional Information Updated View Revisions
2012-02-03 11:32 aaa Assigned To aaa => san
2012-02-03 11:33 aaa Note Added: 0019371
2012-02-03 11:33 aaa Status assigned => feedback
2012-02-03 11:33 aaa Assigned To san => aaa
2012-02-03 11:34 aaa Note Deleted: 0019371
2012-02-03 11:34 aaa Note Added: 0019372
2012-02-03 11:34 aaa Assigned To aaa => san
2012-02-03 11:34 aaa Status feedback => resolved
2012-02-03 11:56 aaa File Added: vcircle.tcl
2012-02-03 11:57 aaa File Added: vplane.tcl
2012-02-03 11:57 aaa File Added: vsegment.tcl
2012-02-03 11:57 aaa File Added: vtriangle.tcl
2012-02-03 12:00 aaa Note Added: 0019373
2012-02-03 16:35 abv Relationship added related to 0022819
2012-02-03 17:46 kgv Note Added: 0019392
2012-02-03 18:02 kgv Note Edited: 0019392 View Revisions
2012-02-03 18:03 kgv Note Edited: 0019392 View Revisions
2012-02-06 17:57 san Assigned To san => aaa
2012-02-07 11:44 aaa Additional Information Updated View Revisions
2012-02-07 11:44 aaa Additional Information Updated View Revisions
2012-02-07 11:45 aaa Note Added: 0019424
2012-02-07 11:45 aaa Assigned To aaa => san
2012-02-07 11:45 aaa Status resolved => assigned
2012-02-07 11:56 san Status assigned => resolved
2012-02-07 12:08 abv Product Version => 6.5.0
2012-02-07 12:08 abv Target Version => 6.5.3
2012-02-08 14:47 san Note Added: 0019460
2012-02-08 14:47 san Assigned To san => aaa
2012-02-08 14:47 san Status resolved => assigned
2012-02-10 11:32 dln Relationship deleted related to 0022819
2012-02-10 14:49 aaa Note Added: 0019508
2012-02-10 14:49 aaa Assigned To aaa => san
2012-02-10 14:49 aaa Status assigned => resolved
2012-02-20 13:16 san Note Added: 0019664
2012-02-20 13:16 san Assigned To san => bugmaster
2012-02-20 13:16 san Status resolved => reviewed
2012-02-20 14:25 mkv Assigned To bugmaster => mkv
2012-02-21 19:52 mkv Note Added: 0019708
2012-02-22 15:02 mkv Status reviewed => tested
2012-02-22 17:06 bugmaster Note Added: 0019745
2012-02-22 17:06 bugmaster Status tested => verified
2012-02-22 17:06 bugmaster Resolution open => fixed
2012-02-22 17:16 mkv File Added: chl_934_T7_T8_T9_U1.tar.gz
2012-02-22 17:17 mkv Test case number => Test cases chl 934 T7 T8 T9 U1
2012-03-29 17:26 bugmaster Changeset attached => occt master ceae62f0


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker