MantisBT - Open CASCADE
View Issue Details
0027194Open CASCADE[OCCT] OCCT:Modeling Algorithmspublic2016-02-20 11:442016-12-09 16:37
aml 
bugmaster 
normalminor 
closedfixed 
[OCCT] 6.9.1 
[OCCT] 7.1.0[OCCT] 7.1.0 
Not needed
0027194: Possible division by zero in IntPatch_WLineTool
This issue is observed in scope of the 0026329 bug.

aStepCoeff = Min(aStepOnS1, aStepOnS2) / Max(aStepOnS1, aStepOnS2);

Such division may lead to the problems when aStepOnS1 and aStepOnS2 are equal to 0.0.

It is necessary to investigate how this situation may happen and elaborate solution. Problem can be reproduced on the CR26329 branch only.
test bugs moddata_2 bug469
No tags attached.
child of 0026329closed kgv Restore floating point signals handling in DRAW 
Issue History
2016-02-20 11:44amlNew Issue
2016-02-20 11:44amlAssigned To => aml
2016-02-20 11:45amlRelationship addedchild of 0026329
2016-02-20 13:39gitNote Added: 0051039
2016-02-20 13:48amlNote Added: 0051040
2016-02-20 13:48amlAssigned Toaml => msv
2016-02-20 13:48amlStatusnew => resolved
2016-02-20 19:10msvNote Added: 0051051
2016-02-20 19:10msvAssigned Tomsv => bugmaster
2016-02-20 19:10msvStatusresolved => reviewed
2016-02-24 16:04mkvAssigned Tobugmaster => mkv
2016-02-24 19:19gitNote Added: 0051091
2016-02-25 17:14mkvNote Added: 0051131
2016-02-25 17:14mkvNote Added: 0051132
2016-02-25 17:14mkvNote Added: 0051133
2016-02-25 17:14mkvAssigned Tomkv => bugmaster
2016-02-25 17:14mkvStatusreviewed => tested
2016-02-25 17:14mkvTest case number => Not needed
2016-03-25 10:50bugmasterTarget Version7.1.0 => 7.0.0
2016-03-28 13:19abvNote Added: 0052064
2016-03-28 13:42amlNote Added: 0052065
2016-03-28 14:39msvNote Added: 0052067
2016-03-28 17:22abvTarget Version7.0.0 => 7.1.0
2016-04-07 16:46abvAssigned Tobugmaster => abv
2016-04-07 16:46abvStatustested => feedback
2016-05-18 09:35gitNote Added: 0054098
2016-05-18 09:36amlNote Added: 0054099
2016-05-18 09:36amlStatusfeedback => resolved
2016-05-18 09:38abvNote Added: 0054100
2016-05-18 09:38abvAssigned Toabv => bugmaster
2016-05-18 09:38abvStatusresolved => reviewed
2016-05-18 14:55mkvAssigned Tobugmaster => mkv
2016-05-19 11:27mkvNote Added: 0054124
2016-05-19 11:27mkvNote Added: 0054125
2016-05-19 11:27mkvAssigned Tomkv => bugmaster
2016-05-19 11:27mkvStatusreviewed => tested
2016-05-20 11:18bugmasterChangeset attached => occt master 871776ea
2016-05-20 11:18bugmasterStatustested => verified
2016-05-20 11:18bugmasterResolutionopen => fixed
2016-05-20 12:20gitNote Added: 0054169
2016-05-20 12:24gitNote Added: 0054233
2016-12-09 16:31aivStatusverified => closed
2016-12-09 16:37aivFixed in Version => 7.1.0

Notes
(0051039)
git   
2016-02-20 13:39   
Branch CR27194 has been created by aml.

SHA-1: 344d80fce487cc9b5014bb20417a47a415b183bd


Detailed log of new commits:

Author: aml
Date: Sat Feb 20 11:54:44 2016 +0300

    0027194: Possible division by zero in IntPatch_WLineTool
    
    Correct handling for division by zero is added. This prevents exception when FPE is enabled
(0051040)
aml   
2016-02-20 13:48   
Dear msv,
Please check current state of the branch CR27194.
(0051051)
msv   
2016-02-20 19:10   
Reviewed.
(0051091)
git   
2016-02-24 19:19   
Branch CR27194 has been updated forcibly by mkv.

SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c
(0051131)
mkv   
2016-02-25 17:14   
Dear BugMaster,
Branch CR27194 was rebased on current master of occt git-repository.
SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c
(0051132)
mkv   
2016-02-25 17:14   
Dear BugMaster,
Branch CR27194 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 41 (41 on master)
Windows: 0 (0 on master)

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 90157515 / 90534753 [-0.42%]
Total CPU difference: 19392.780000000017 / 19576.420000000107 [-0.94%]
products component :
Total MEMORY difference: 25923801 / 25872807 [+0.20%]
Total CPU difference: 5361.569999999991 / 5316.139999999985 [+0.85%]

Testing on Windows:
occt component :
Total MEMORY difference: 57375213 / 57106337 [+0.47%]
Total CPU difference: 18744.31575509885 / 17710.10712559875 [+5.84%]
products component :
Total MEMORY difference: 17493005 / 17395600 [+0.56%]
Total CPU difference: 5411.159886699964 / 5095.257861699954 [+6.20%]

There are no differences in images found by testdiff.
(0051133)
mkv   
2016-02-25 17:14   
Dear BugMaster,
Branch CR27194 is TESTED.
(0052064)
abv   
2016-03-28 13:19   
Remarks on proposed fix:

1. Please avoid comparing real numbers for equality using operator == or != -- this will not work in general case. For instance, AFAIK, -0 != +0

2. In order to protect against division by zero, it would be sufficient to check the value of Max(aStepOnS1, aStepOnS2), so why checking both aStepOnS1 and aStepOnS2 individually?

3. What happens if aStepOnS1=1e-308 and aStepOnS2 = 10? Should not the behavior be the same as when aStepOnS1=0. and aStepOnS2=1.? (currently it will be different).
(0052065)
aml   
2016-03-28 13:42   
1. Please avoid comparing real numbers for equality using operator == or != -- this will not work in general case. For instance, AFAIK, -0 != +0

if (+0.0 == -0.0)
 cout << "EQUAL";

Returns true in MSVC2010. Here only +0.0 is used due to values nature.

2. In order to protect against division by zero, it would be sufficient to check the value of Max(aStepOnS1, aStepOnS2), so why checking both aStepOnS1 and aStepOnS2 individually?

Max(aStepOnS1, aStepOnS2) is not computed directly.

3. What happens if aStepOnS1=1e-308 and aStepOnS2 = 10? Should not the behavior be the same as when aStepOnS1=0. and aStepOnS2=1.? (currently it will be different).

Denormal numbers will be used.
(0052067)
msv   
2016-03-28 14:39   
1. I agree. It is better to compare with gp::Resolution(), that is RealSmall().

2. Checking of Max only is not enough, we must check also Min.

3. If we check both values this will not happen.
(0054098)
git   
2016-05-18 09:35   
Branch CR27194_2 has been created by aml.

SHA-1: 53048499310b606d35639eb94af83ad76d031083


Detailed log of new commits:

Author: aml
Date: Sat Feb 20 11:54:44 2016 +0300

    0027194: Possible division by zero in IntPatch_WLineTool
    
    Correct handling for division by zero is added. This prevents exception when FPE is enabled
(0054099)
aml   
2016-05-18 09:36   
Dear abv,
Please check current state of the CR27194_2 branch.
(0054100)
abv   
2016-05-18 09:38   
No remarks, please test
(0054124)
mkv   
2016-05-19 11:27   
Dear BugMaster,
Branch CR27194_2 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 53048499310b606d35639eb94af83ad76d031083

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 72 (72 on master)
Windows: 4 (4 on master)
MacOS : 1144

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 88283719 / 87385561 [+1.03%]
Total CPU difference: 19284.279999999915 / 19257.83 [+0.14%]
products component :
Total MEMORY difference: 27790493 / 27718261 [+0.26%]
Total CPU difference: 5231.579999999983 / 5200.899999999987 [+0.59%]

Testing on Windows:
occt component :
Total MEMORY difference: 55779341 / 55791306 [-0.02%]
Total CPU difference: 18062.716185898837 / 17814.222192998932 [+1.39%]
products component :
Total MEMORY difference: 18925839 / 18889957 [+0.19%]
Total CPU difference: 5175.707577399963 / 4958.179782999945 [+4.39%]

There are no differences in images found by testdiff.
(0054125)
mkv   
2016-05-19 11:27   
Dear BugMaster,
Branch CR27194_2 is TESTED.
(0054169)
git   
2016-05-20 12:20   
Branch CR27194_2 has been deleted by inv.

SHA-1: 53048499310b606d35639eb94af83ad76d031083
(0054233)
git   
2016-05-20 12:24   
Branch CR27194 has been deleted by inv.

SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c