MantisBT - Community
View Issue Details
0023504Community[OCCT] OCCT:Modeling Algorithmspublic2012-11-01 15:062012-11-16 13:18
Vitezslav Zajic 
Vitezslav Zajic 
normalcrash 
closedfixed 
WindowsVC++ 201032 bit
[OCCT] 6.5.3 
[OCCT] 6.5.4[OCCT] 6.5.4 
0023504: The function Adaptor3d_TopolTool::BSplSamplePnts leaves uninitialized items in myUPars and myVPars arrays
The function Adaptor3d_TopolTool::BSplSamplePnts leaves uninitialized items in myUPars and myVPars arrays, which are later used by IntPolyh_MaillageAffinage::FillArrayOfPnt function and this triggers an OuOfRange exception in Geom_BSplineSurface::ValidateCache (see attached screenshot of the debugger).

The following code (part of Adaptor3d_TopolTool::BSplSamplePnts function) creates an array myUPars of the size myNbSamplesU, but if some item in anUFlg array is set to false, it does not initializes all of the items in myUPars:

  //
  // U
  bFlag=(myNbSamplesU < theNUmin);
  if (bFlag) {
    myNbSamplesU=nbsu;
  }
  //
  myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
  //
  for(j = 0, i = 1; i <= nbsu; ++i) {
    if (bFlag) {
       myUPars->SetValue(i,anUPars(i));
    }
    else {
      if(anUFlg(i)) {
    ++j;
    myUPars->SetValue(j,anUPars(i));
      }
    }
  }
  //

I've replaced this code with the following one that solved the problem for me:

  //
  // U
  myNbSamplesU = nbsu;
  if (bFlag)
  {
    myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
    for (i = 1; i <= nbsu; ++i)
    {
      myUPars->SetValue(i,anUPars(i));
    }
  }
  else
  {
    for (i = 1; i <= nbsu; ++i)
    {
      if (!anUFlg(i))
      {
        --myNbSamplesU;
      }
    }
    myUPars = new TColStd_HArray1OfReal(1, myNbSamplesU);
    for(j = 0, i = 1; i <= nbsu; ++i)
    {
      if(anUFlg(i))
      {
          ++j;
          myUPars->SetValue(j, anUPars(i));
      }
    }
  }
  //

The same applies for V parameters.
No tags attached.
png OCCT crash.png (153,404) 2012-11-01 15:06
https://tracker.dev.opencascade.org/
Issue History
2012-11-01 15:06Vitezslav ZajicNew Issue
2012-11-01 15:06Vitezslav ZajicAssigned To => jgv
2012-11-01 15:06Vitezslav ZajicFile Added: OCCT crash.png
2012-11-01 15:32abvTarget Version => 6.5.4
2012-11-02 18:09jgvNote Added: 0022089
2012-11-02 18:09jgvStatusnew => resolved
2012-11-02 18:09jgvAssigned Tojgv => abv
2012-11-08 09:30abvRelationship addedrelated to 0023472
2012-11-08 09:50abvAssigned Toabv => Vitezslav Zajic
2012-11-08 09:50abvStatusresolved => reviewed
2012-11-08 09:52abvRelationship replacedduplicate of 0023472
2012-11-08 09:52abvStatusreviewed => verified
2012-11-08 09:52abvResolutionopen => fixed
2012-11-08 09:52abvChangeset attached => occt master 07782e0c
2012-11-16 13:13bugmasterFixed in Version => 6.5.4
2012-11-16 13:18bugmasterStatusverified => closed

Notes
(0022089)
jgv   
2012-11-02 18:09   
This bug has been fixed by the patch to 23472