[Insight-developers] Re: Limitation in MetaIO causing problems in itkNeuralNetworkFileReader/Writer

Stephen R. Aylward Stephen.Aylward at Kitware.com
Mon Aug 20 18:19:52 EDT 2007


Seems like the metaio library is being misused.  The fields are only 
intended for holding tag/value pairs.   Reading/writing large amounts of 
data should done directly to the file or to an external file.

Look at how matrix, arrays, and images are read/written - first read the 
tag/value pairs that specify how much data should be read/written, and 
then directly read/write the data from the file after the tag/value 
pairs.  Also, it should support writing those arrays as ascii or binary 
data.

It could be done the way you suggested, but that was not the design for 
metaIO.

Hope this helps,
Stephen

kent williams wrote:
> I logged this as a bug: http://www.itk.org/Bug/view.php?id=5545
> 
> The bug report has more details, but there are 2 limitations with MetaIO, in
> the context of the NeuralNet I/O classes: The MET_FieldRecordType is a C
> structure, not a C++ class, and it contains a value array with a fixed size
> of 255.
> 
> I'm testing a very quick and dirty fix -- simply enlarging the value array
> so that Hans can move forward with his NeuralNetwork code testing*, but
> MetaIO maybe deserves some new scrutiny.
> 
> Given that it's been around for years in ITK, I can't think of what I'd do
> that wouldn't break backwards compatibility. The obvious thing to do would
> be to move MET_FieldRecordType to a C++ class, make the value array
> resizable, etc.  Any code depending on the current state of play would
> break.
> 
> 
> * and putting a test in MET_InitWriteField so it won't scribble all over
> memory.  There are, as I count them, 4 separate potential buffer overruns in
> that function.
> 
> 

-- 
=============================================================
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc. - Chapel Hill Office
http://www.kitware.com
Phone: (518)371-3971 x300


More information about the Insight-developers mailing list