View Issue Details

IDProjectCategoryView StatusLast Update
0027194Open CASCADEOCCT:Modeling Algorithmspublic2016-12-09 16:37
ReporteramlAssigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version6.9.1 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027194: Possible division by zero in IntPatch_WLineTool
DescriptionThis 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.
Steps To Reproducetest bugs moddata_2 bug469
TagsNo tags attached.
Test case numberNot needed

Relationships

child of 0026329 closedkgv Restore floating point signals handling in DRAW 

Activities

git

2016-02-20 13:39

administrator   ~0051039

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

aml

2016-02-20 13:48

developer   ~0051040

Dear msv,
Please check current state of the branch CR27194.

msv

2016-02-20 19:10

developer   ~0051051

Reviewed.

git

2016-02-24 19:19

administrator   ~0051091

Branch CR27194 has been updated forcibly by mkv.

SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c

mkv

2016-02-25 17:14

tester   ~0051131

Dear BugMaster,
Branch CR27194 was rebased on current master of occt git-repository.
SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c

mkv

2016-02-25 17:14

tester   ~0051132

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.

mkv

2016-02-25 17:14

tester   ~0051133

Dear BugMaster,
Branch CR27194 is TESTED.

abv

2016-03-28 13:19

manager   ~0052064

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).

aml

2016-03-28 13:42

developer   ~0052065

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.

msv

2016-03-28 14:39

developer   ~0052067

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.

git

2016-05-18 09:35

administrator   ~0054098

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

aml

2016-05-18 09:36

developer   ~0054099

Dear abv,
Please check current state of the CR27194_2 branch.

abv

2016-05-18 09:38

manager   ~0054100

No remarks, please test

mkv

2016-05-19 11:27

tester   ~0054124

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.

mkv

2016-05-19 11:27

tester   ~0054125

Dear BugMaster,
Branch CR27194_2 is TESTED.

git

2016-05-20 12:20

administrator   ~0054169

Branch CR27194_2 has been deleted by inv.

SHA-1: 53048499310b606d35639eb94af83ad76d031083

git

2016-05-20 12:24

administrator   ~0054233

Branch CR27194 has been deleted by inv.

SHA-1: 1c61ca27c396b2da5630f3ba07446ec366bad51c

Related Changesets

occt: master 871776ea

2016-02-20 08:54:44

aml


Committer: bugmaster Details Diff
0027194: Possible division by zero in IntPatch_WLineTool

Correct handling for division by zero is added. This prevents exception when FPE is enabled
Affected Issues
0027194
mod - src/IntPatch/IntPatch_WLineTool.cxx Diff File

Issue History

Date Modified Username Field Change
2016-02-20 11:44 aml New Issue
2016-02-20 11:44 aml Assigned To => aml
2016-02-20 11:45 aml Relationship added child of 0026329
2016-02-20 13:39 git Note Added: 0051039
2016-02-20 13:48 aml Note Added: 0051040
2016-02-20 13:48 aml Assigned To aml => msv
2016-02-20 13:48 aml Status new => resolved
2016-02-20 19:10 msv Note Added: 0051051
2016-02-20 19:10 msv Assigned To msv => bugmaster
2016-02-20 19:10 msv Status resolved => reviewed
2016-02-24 16:04 mkv Assigned To bugmaster => mkv
2016-02-24 19:19 git Note Added: 0051091
2016-02-25 17:14 mkv Note Added: 0051131
2016-02-25 17:14 mkv Note Added: 0051132
2016-02-25 17:14 mkv Note Added: 0051133
2016-02-25 17:14 mkv Assigned To mkv => bugmaster
2016-02-25 17:14 mkv Status reviewed => tested
2016-02-25 17:14 mkv Test case number => Not needed
2016-03-25 10:50 bugmaster Target Version 7.1.0 => 7.0.0
2016-03-28 13:19 abv Note Added: 0052064
2016-03-28 13:42 aml Note Added: 0052065
2016-03-28 14:39 msv Note Added: 0052067
2016-03-28 17:22 abv Target Version 7.0.0 => 7.1.0
2016-04-07 16:46 abv Assigned To bugmaster => abv
2016-04-07 16:46 abv Status tested => feedback
2016-05-18 09:35 git Note Added: 0054098
2016-05-18 09:36 aml Note Added: 0054099
2016-05-18 09:36 aml Status feedback => resolved
2016-05-18 09:38 abv Note Added: 0054100
2016-05-18 09:38 abv Assigned To abv => bugmaster
2016-05-18 09:38 abv Status resolved => reviewed
2016-05-18 14:55 mkv Assigned To bugmaster => mkv
2016-05-19 11:27 mkv Note Added: 0054124
2016-05-19 11:27 mkv Note Added: 0054125
2016-05-19 11:27 mkv Assigned To mkv => bugmaster
2016-05-19 11:27 mkv Status reviewed => tested
2016-05-20 11:18 bugmaster Changeset attached => occt master 871776ea
2016-05-20 11:18 bugmaster Status tested => verified
2016-05-20 11:18 bugmaster Resolution open => fixed
2016-05-20 12:20 git Note Added: 0054169
2016-05-20 12:24 git Note Added: 0054233
2016-12-09 16:31 aiv Status verified => closed
2016-12-09 16:37 aiv Fixed in Version => 7.1.0