Commit 98af77a1 authored by David Lonie's avatar David Lonie Committed by Kitware Robot
Browse files

Merge topic 'generic_clip_contour_fix'

e4150497 Fix out-of-range array access in HyperOctreeContour.
25f0495b Fix invalid array accesses in generic filters.
7b010075

 Validate input indices in InterpolateTuple.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !935
parents c15a4dac e4150497
......@@ -465,6 +465,22 @@ void vtkDataArray::InterpolateTuple(vtkIdType i,
return;
}
if (id1 >= source1->GetNumberOfTuples())
{
vtkErrorMacro("Tuple 1 out of range for provided array. "
"Requested tuple: " << id1 << " "
"Tuples: " << source1->GetNumberOfTuples());
return;
}
if (id2 >= source2->GetNumberOfTuples())
{
vtkErrorMacro("Tuple 2 out of range for provided array. "
"Requested tuple: " << id2 << " "
"Tuples: " << source2->GetNumberOfTuples());
return;
}
int k, numComp = source1->GetNumberOfComponents();
double c;
vtkIdType loc = i * numComp;
......
......@@ -430,6 +430,7 @@ void vtkGenericAdaptorCell::Contour(vtkContourValues *contourValues,
{
assert("check: valid number of points" && npts == ptsCount);
range[1] = range[0] = scalars->GetComponent(dataIndex,currComp);
secondaryPd->Reset();
for(i=0; i<ptsCount; i++, point+=3)
{
linearCell->PointIds->SetId(i, pts[i]);
......@@ -448,7 +449,6 @@ void vtkGenericAdaptorCell::Contour(vtkContourValues *contourValues,
range[0] = range[0] < contVal ? range[0] : contVal;
range[1] = range[1] > contVal ? range[1] : contVal;
// for each point-centered attribute
secondaryPd->Reset();
j=0;
while(j<c)
{
......@@ -651,6 +651,7 @@ void vtkGenericAdaptorCell::Clip(double value,
this->InternalCellArray->GetNextCell(npts, pts);)
{
assert("check: valid number of points" && npts == ptsCount);
secondaryPd->Reset();
for(i=0; i<ptsCount; i++, point+=3)
{
linearCell->PointIds->SetId(i, pts[i]);
......@@ -667,7 +668,6 @@ void vtkGenericAdaptorCell::Clip(double value,
// current linear simplex.
// for each point-centered attribute
secondaryPd->Reset();
j=0;
while(j<c)
{
......
......@@ -339,7 +339,7 @@ int vtkHyperOctreeContourFilter::RequestData(
this->OutCD->CopyAllocate(this->InCD,estimatedSize,estimatedSize/2);
this->OutPD=this->Output->GetPointData();
this->OutPD->CopyAllocate(this->Input->GetPointData(),estimatedSize,estimatedSize/2);
this->OutPD->CopyAllocate(this->InPD,estimatedSize,estimatedSize/2);
this->OutPD->CopyScalarsOn();
static double bounds[6]={0,1,0,1,0,1};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment