MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0006771 | VTK | (No Category) | public | 2008-04-08 09:30 | 2016-08-12 09:54 |
| Reporter | Levap | ||||
| Assigned To | Kitware Robot | ||||
| Priority | normal | Severity | crash | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Project | |||||
| Type | |||||
| Summary | 0006771: Bug in vtkImageReader | ||||
| Description | The following code snippet leads to crash (null pointer access) on a Windows XP 32bit SP2, with 2 GB RAM. Code snippet: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vtkImageData* img = vtkImageDate::New(); vtkImageReader* ir = vtkImageReader::New(); ir->SetFileName(“d:\\myvolume.raw”); ir->SetFileDimensionality(3); ir->SetDataByteOrderToLittleEndian(); ir->SetDataScalarType(VTK_FLOAT); ir->SetDataExtent(0, 580, 0, 580, 0, 500); ir->SetDataOrigin(0, 0, 0); ir->SetDataSpacing(1, 1, 1); ir->SetHeaderSize(0); // no header ir->SetNumberOfScalarComponents(1); ir->SwapBytesOff(); ir->SetFileLowerLeft(1); ir->SetOutput(img); ir->Update(); ir->Delete(); img->Delete(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Explanation and approach to a problem: I’m trying to load a large volume (> 640 MB), but operating system fails to allocate enough memory in the function vtkDataArrayTemplate<T>::Allocate(vtkIdType sz, vtkIdType) (file: vtkDataArrayTemplate.txx), so it leads to a following error massege: ERROR: In d:\work\libs\vtk\5_1_0\source\common\vtkDataArrayTemplate.txx, line 133 vtkFloatArray (02736950): Unable to allocate 168200000 elements of size 4 bytes. This behavior is OK! The problem is the next step: despite of the false allocation the vtkImageReader tries to load the volume and make an access to null pointer -> this leads to a crash. Let us take a close look at the function vtkImageReader::ExecuteData(vtkDataObject *output) in the file vtkImageReader.cxx. The error message is produced during the call in the first line of the function: vtkImageData *data = this->AllocateOutputData(output); After this line I would place a check block for a successful memory allocation, something like this: if (!data->GetScalarPointer()) { return; } | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2008-04-08 09:30 | Levap | New Issue | |||
| 2011-06-16 13:11 | Zack Galbreath | Category | => (No Category) | ||
| 2016-08-12 09:54 | Kitware Robot | Note Added: 0036966 | |||
| 2016-08-12 09:54 | Kitware Robot | Status | expired => closed | ||
| 2016-08-12 09:54 | Kitware Robot | Resolution | open => moved | ||
| 2016-08-12 09:54 | Kitware Robot | Assigned To | => Kitware Robot | ||
| Notes | |||||
|
|
|||||
|
|
||||