View Issue Details

IDProjectCategoryView StatusLast Update
0001712OpenFOAM[All Projects] Bugpublic2015-05-28 16:24
Reporteruser1148Assigned Tohenry 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version15.04
Product Version 
Fixed in Version 
Summary0001712: Bad container resizings in viewFactorsGen.C
DescriptionThe container triSurfaceToAgglom is being resized with one element too short, s. patch file. This might lead to a crash if a ray hits the very last triangle of the detailed surface, which then could not be mapped to the correct coarse face.
Steps To ReproduceLook at the loop above "triSurfaceToAgglom.resize(localTriFaceI-1)". The counter localTriFaceI already tracks the correct size of the container. It is not needed to subtract 1 after the loop.

There is actually some second mistake in "viewFactorsPatches.resize(count--)", s. patch file. It does not lead to a wrong size, but to a potentially unexpected value of count. Fortunately, count is not (yet) being reused.
Additional InformationThe bug is there at least since 2.3 and is still there in dev.
TagsNo tags attached.

Activities

user1148

2015-05-27 16:35

 

viewFactorsGen.patch (703 bytes)
diff -r 9673e8cd8d75 applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C
--- a/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C	Tue May 26 11:32:46 2015 +0100
+++ b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C	Tue May 26 15:51:07 2015 +0200
@@ -130,7 +130,7 @@
         newPatchI++;
     }
 
-    triSurfaceToAgglom.resize(localTriFaceI-1);
+    triSurfaceToAgglom.resize(localTriFaceI);
 
     triangles.shrink();
 
@@ -369,7 +369,7 @@
         }
     }
 
-    viewFactorsPatches.resize(count--);
+    viewFactorsPatches.resize(count);
 
     // total number of coarse faces
     label totalNCoarseFaces = nCoarseFaces;
viewFactorsGen.patch (703 bytes)

wyldckat

2015-05-28 13:03

updater   ~0004826

This seems somewhat similar to the issue reported in #1157: http://www.openfoam.org/mantisbt/view.php?id=1157

user1148

2015-05-28 16:18

  ~0004827

Yes, in the best case #1157 is caused by a similar typo (though hard to find). In the maybe worst case #1157 is caused by inconsistencies from mesh generation.

This bug here generates segfaults even if #1157 was fixed and vice versa.
Hence I would regard it to be possibly similar, but in any case independent.

henry

2015-05-28 16:24

manager   ~0004828

Thanks for the bug-report and patch.
Resolved by commit 59134ff9f8ed71523f75b0a4f3f81bcd444a7955 in OpenFOAM-dev
Resolved by commit 5eb755819f9ca83664a1f40a54e6e6c9ffd311ec in OpenFOAM-2.4.x

Issue History

Date Modified Username Field Change
2015-05-27 16:35 user1148 New Issue
2015-05-27 16:35 user1148 File Added: viewFactorsGen.patch
2015-05-28 13:03 wyldckat Note Added: 0004826
2015-05-28 16:18 user1148 Note Added: 0004827
2015-05-28 16:24 henry Note Added: 0004828
2015-05-28 16:24 henry Status new => resolved
2015-05-28 16:24 henry Resolution open => fixed
2015-05-28 16:24 henry Assigned To => henry