Archived issue #0024195
Use of uninitialized data in IntCurve_IntPolyPolyGen.gxx
Description
During testing of several fixes for #14108, #0024168 several new unstable regressions appeared in functionality not affected by the changes being tested (data exchange and offsets). These regressions appeared in build #148 of master branch, and previously in testing fix for #24108 on my local machine.
Running under debugger revealed access to uninitialized field in IntCurve_IntPolyPolyGen::findIntersect(), introduced by fix for #23587 (included in OCCT 6.5.5): when isFullPolygon is True, in case when IntCurve_ExactIntersectionPoint does not find a solution (NbRoots() returns 0), that solution is requested and uninitialized values of U and V returned by the tool are used in calculations, leading to floating-point errors.
It is not clear how to treat this situation correctly:
- returning if NbRoots() is zero causes several regressionss (see 0024108:0025601 for the list)
- putting "continue" or using ParamOn1 and ParamOn2 instead of U and V seems to work well when built with VC11 64-bit mode but causes problem with infinite memory allocation in test de iges_1 L8 when built by VC9 in 32-bit mode
Perhaps the correct way to treat the situation should be to ensure that IntCurve_ExactIntersectionPoint never fails. To be investigated.
Running under debugger revealed access to uninitialized field in IntCurve_IntPolyPolyGen::findIntersect(), introduced by fix for #23587 (included in OCCT 6.5.5): when isFullPolygon is True, in case when IntCurve_ExactIntersectionPoint does not find a solution (NbRoots() returns 0), that solution is requested and uninitialized values of U and V returned by the tool are used in calculations, leading to floating-point errors.
It is not clear how to treat this situation correctly:
- returning if NbRoots() is zero causes several regressionss (see 0024108:0025601 for the list)
- putting "continue" or using ParamOn1 and ParamOn2 instead of U and V seems to work well when built with VC11 64-bit mode but causes problem with infinite memory allocation in test de iges_1 L8 when built by VC9 in 32-bit mode
Perhaps the correct way to treat the situation should be to ensure that IntCurve_ExactIntersectionPoint never fails. To be investigated.
Steps to reproduce
DE test cases showing the problem in master run #148:
bugs iges bug23377
de step_1 E2 E9 K2 O1 R1 S2
de step_2 F7 I7
de step_4 A1
de step_5 A1
The characteristic point is exception reported by tpstat command in the log:
...
1 F:SHELL_BASED_SURFACE_MODEL: Exeption is raised. Entity was not translated.
Offset test cases (fail with FLT_INVALID_OPERATION):
offset wire_closed_outside_0_075 G6 H2
bugs iges bug23377
de step_1 E2 E9 K2 O1 R1 S2
de step_2 F7 I7
de step_4 A1
de step_5 A1
The characteristic point is exception reported by tpstat command in the log:
...
1 F:SHELL_BASED_SURFACE_MODEL: Exeption is raised. Entity was not translated.
Offset test cases (fail with FLT_INVALID_OPERATION):
offset wire_closed_outside_0_075 G6 H2
Public activity
12 archived notes
Participants are labeled by their role within this record.
CR24195 is ready for rewieving and testing.
Branch contains modifications that are similar to modifications made by Author for 24108, but problems with de iges_1 L8 and some other regressions are not reproduced.
Branch contains modifications that are similar to modifications made by Author for 24108, but problems with de iges_1 L8 and some other regressions are not reproduced.
Ok
Dear Commenter 2,
Branch CR24195 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 505 (506 on master)
Windows: 32 (31 on master)
New warning compilation on Windows platform:
IntCurve_IntPolyPolyGen.gxx:875, MSBuild, Priority: Normal
'aNbRoots' : local variable is initialized but not referenced
products component :
Linux: 191 (190 on master)
Windows: 287 (287 on master)
Regressions/differences:
http://occt-tests/CR24195-master-occt/Debian60-64/summary.html
http://occt-tests/CR24195-master-occt/Windows-32-VC9/summary.html
de iges_1(001) R8
de iges_2(002) I7
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 365990016 / 365791512
Total CPU difference: 53875.40000000022 / 42156.03000000098
Testing on Windows:
Total MEMORY difference: 428455932 / 428640164
Total CPU difference: 47005.625 / 47587.203125
There are not differences in images found by testdiff.
Branch CR24195 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 505 (506 on master)
Windows: 32 (31 on master)
New warning compilation on Windows platform:
IntCurve_IntPolyPolyGen.gxx:875, MSBuild, Priority: Normal
'aNbRoots' : local variable is initialized but not referenced
products component :
Linux: 191 (190 on master)
Windows: 287 (287 on master)
Regressions/differences:
http://occt-tests/CR24195-master-occt/Debian60-64/summary.html
http://occt-tests/CR24195-master-occt/Windows-32-VC9/summary.html
de iges_1(001) R8
de iges_2(002) I7
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 365990016 / 365791512
Total CPU difference: 53875.40000000022 / 42156.03000000098
Testing on Windows:
Total MEMORY difference: 428455932 / 428640164
Total CPU difference: 47005.625 / 47587.203125
There are not differences in images found by testdiff.
In my understanding, the two reported differences are not regressions (the latter is rather improvement since checkshape error has disappeared).
I agree that listed above test cases are not regressions.
Test cases:
de iges_1(001) R8
de iges_2(002) I7
should be updated.
Test cases:
de iges_1(001) R8
de iges_2(002) I7
should be updated.
Dear abv,
There is new warning compilation on Windows platform:
IntCurve_IntPolyPolyGen.gxx:875, MSBuild, Priority: Normal
'aNbRoots' : local variable is initialized but not referenced
There is new warning compilation on Windows platform:
IntCurve_IntPolyPolyGen.gxx:875, MSBuild, Priority: Normal
'aNbRoots' : local variable is initialized but not referenced
I have pushed the code with slight changes (removal of unused variable pointed out by mkv, swapping of continue and return, and removal of tabs) to branch CR24195_1. Please review.
Besides, I noticed that first method Perform() in this gxx file has internal variable AnErrorOccurred which is used but never changes. Hence, a piece of code aimed to deal with error situation is apparently never called. Please consider whether there is an error in that to be fixed (at least, remove that variable and inactive code).
Besides, I noticed that first method Perform() in this gxx file has internal variable AnErrorOccurred which is used but never changes. Hence, a piece of code aimed to deal with error situation is apparently never called. Please consider whether there is an error in that to be fixed (at least, remove that variable and inactive code).
CR24195_2 is reafy to testing
Unnecessary code is removed.
Unnecessary code is removed.
Dear Commenter 2,
Branch CR24195_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 426 (426 on master)
Windows: 24 (24 on master)
products component :
Linux: 189 (190 on master)
Windows: 287 (287 on master)
Regressions/Differences:
http://occt-tests/CR24195-2-master-occt/Debian60-64/bugs/moddata_2/bug23587.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/bugs/moddata_2/bug23587.html
bugs moddata_2(012) bug23587
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_1/P5.html
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_1/R8.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_1/P5.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_1/R8.html
de iges_1(001) P5, R8
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_2/H9.html
de iges_2(002) H9 - only on Linux
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_2/I7.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_2/I7.html
de iges_2(002) I7
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/step_3/E6.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/step_3/E6.html
de step_3(006) E6
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 364618636 / 364507312
Total CPU difference: 41584.19000000114 / 44036.90000000129
Testing on Windows:
Total MEMORY difference: 432564408 / 432531108
Total CPU difference: 37209.25 / 34282.875
There are not differences in images found by testdiff.
Branch CR24195_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 426 (426 on master)
Windows: 24 (24 on master)
products component :
Linux: 189 (190 on master)
Windows: 287 (287 on master)
Regressions/Differences:
http://occt-tests/CR24195-2-master-occt/Debian60-64/bugs/moddata_2/bug23587.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/bugs/moddata_2/bug23587.html
bugs moddata_2(012) bug23587
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_1/P5.html
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_1/R8.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_1/P5.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_1/R8.html
de iges_1(001) P5, R8
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_2/H9.html
de iges_2(002) H9 - only on Linux
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/iges_2/I7.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/iges_2/I7.html
de iges_2(002) I7
http://occt-tests/CR24195-2-master-occt/Debian60-64/de/step_3/E6.html
http://occt-tests/CR24195-2-master-occt/Windows-32-VC9/de/step_3/E6.html
de step_3(006) E6
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 364618636 / 364507312
Total CPU difference: 41584.19000000114 / 44036.90000000129
Testing on Windows:
Total MEMORY difference: 432564408 / 432531108
Total CPU difference: 37209.25 / 34282.875
There are not differences in images found by testdiff.
CR24195_2 with fix for regressions is ready for testing
CR24195_2 with fix for regressions is ready for testing
Dear Commenter 2,
Branch CR24195_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 426 (426 on master)
Windows: 24 (24 on master)
products component :
Linux: 190 (190 on master)
Windows: 287 (287 on master)
Regressions/Differences:
No regressions/differences
Test cases de/iges_1/R8 and de/iges_2/I7 were modified according to new data
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 366153100 / 366159080
Total CPU difference: 46481.86000000062 / 44691.370000001305
Testing on Windows:
Total MEMORY difference: 432915796 / 433120940
Total CPU difference: 36949.984375 / 34518.96875
There are not differences in images found by testdiff.
Branch CR24195_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 426 (426 on master)
Windows: 24 (24 on master)
products component :
Linux: 190 (190 on master)
Windows: 287 (287 on master)
Regressions/Differences:
No regressions/differences
Test cases de/iges_1/R8 and de/iges_2/I7 were modified according to new data
Testing cases:
Not needed
Testing on Linux:
Total MEMORY difference: 366153100 / 366159080
Total CPU difference: 46481.86000000062 / 44691.370000001305
Testing on Windows:
Total MEMORY difference: 432915796 / 433120940
Total CPU difference: 36949.984375 / 34518.96875
There are not differences in images found by testdiff.