View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000693VTK(No Category)public2004-03-22 11:232013-04-05 19:57
ReporterMarcel Jackowski 
Assigned ToZhanping Liu 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000693: vtkHyperStreamline
DescriptionThis class seg faults if pointer sPtr is accessed after a call to InsertNextHyperPoint if the array of points gets resized. Below follows the snippet where crashing typically occur.

excerpt from line 531:

sNext = this->Streamers[ptId].InsertNextHyperPoint();

      if ( cell->EvaluatePosition(xNext, closestPoint, sNext->SubId,
      sNext->P, dist2, w) )
        { //integration still in cell
        for (i=0; i<3; i++)
          {
          sNext->X[i] = closestPoint[i];
          }
        sNext->CellId = sPtr->CellId; (crashes if array is resized - sPtr is not valid anymore)
        sNext->SubId = sPtr->SubId;
        }
      else ...

A temporary fix can be done by restoring the sPtr pointer after insertion of new point:

 // get a hold of the number of points
      index = this->Streamers[ptId].GetNumberOfPoints();
      
      // insert next point
      sNext = this->Streamers[ptId].InsertNextHyperPoint();
      
      // make sure sPtr is still valid after possible Resizing
      sPtr = this->Streamers[ptId].GetHyperPoint(index-1);
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0000788)
Mathieu Malaterre (developer)
2004-03-22 17:52

Mjack,

   could you please provide more info about the 'resize' problem. I don't have any example in mind where the data is resized. The ideal case would be that you provide a python/c++/tcl example that shows the crash.
Thanks
(0013707)
Zhanping Liu (developer)
2008-10-02 11:43

BUG: 0000693 has been fixed. The problem was due to a broken / wild pointer (sPtr) indirectly caused through (new line #559 or old line 0000531)

     =============================================
     this->Streamers[ptId].InsertNextHyperPoint();
     =============================================

     in vtkHyperStreamline::RequestData().

Now a safe handle to, i.e., the index of, sPtr in the vtkHyperPoint Array (Streamers[ptId]) is saved immediately before

     =============================================
     this->Streamers[ptId].InsertNextHyperPoint();
     =============================================

     and sPtr is guaranteed to point to the target after a possible memory resize operation.

     Thanks for reporting this bug and the great suggestions.
(0013708)
Zhanping Liu (developer)
2008-10-02 11:43

new revision: 1.62; previous revision: 1.61

 Issue History
Date Modified Username Field Change
2008-09-23 11:28 Berk Geveci Assigned To Mathieu Malaterre => Zhanping Liu
2008-10-02 11:43 Zhanping Liu Note Added: 0013707
2008-10-02 11:43 Zhanping Liu Note Added: 0013708
2008-10-02 11:45 Zhanping Liu Status tabled => @80@
2008-10-02 11:45 Zhanping Liu Description Updated
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2013-04-05 19:57 Berk Geveci Status customer review => closed


Copyright © 2000 - 2018 MantisBT Team