MantisBT - ParaView
View Issue Details
0012187ParaViewBugpublic2011-05-12 14:582016-08-12 09:58
Pat Marion 
Ken Moreland 
normalcrashalways
closedmoved 
 
 
0012187: Crash in Exodus reader's ReadMetaDataFile
I have a .bin file that I want to open with the raw image reader. Paraview doesn't recognize the .bin extension though, so it presents me with a list of readers to choose from. In order to compile the list of available readers, paraview calls CanReadFile("test.bin") on every reader. When it gets to the vtkExodusFileSeriesReader there is a crash.

It goes:

1) vtkFileSeriesReader::CanReadFile("test.bin")

2) if (this->UseMetaFile) <-- true

3) vtkFileSeriesReader::ReadMetaDataFile("test.bin")

This routine opens test.bin as an ifstream and reads the contents into a std::string: metafile >> fname;
Now fname contains garbage, because this is a raw image file.

4) vtkExodusIIReader::CanReadFile(<garbage>)

  This routine fails to open the file, tries to create an error message and calls strcpy on the garbage value and crashes.


So this can be avoided if we check that metafile >> fname reads only ascii characters. One solution is adding:

    for (size_t i = 0; i < fname.size(); ++i)
      {
      if (static_cast<unsigned char>(fname[i]) > 127)
        {
        return 0;
        }
      }


Is it ok to call metafile >> fname on binary files? We could read metafile character by character instead of checking fname after the fact. Are there any scenarios where metafile uses a non ascii text encoding that should be supported?
No tags attached.
Issue History
2011-05-12 14:58Pat MarionNew Issue
2011-05-12 14:58Pat MarionStatusbacklog => tabled
2011-05-12 14:58Pat MarionAssigned To => Ken Moreland
2016-08-12 09:58Kitware RobotNote Added: 0037974
2016-08-12 09:58Kitware RobotStatusbacklog => closed
2016-08-12 09:58Kitware RobotResolutionopen => moved

Notes
(0037974)
Kitware Robot   
2016-08-12 09:58   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current ParaView Issues page linked in the banner at the top of this page.