[vtkusers] VTK throwing an error due to large magnitudes in ASCII floating-point data

Jack Poulson jack.poulson at gmail.com
Tue Dec 20 11:42:33 EST 2011


Hello,

I posted this on the ParaView list two weeks ago and received no response,
and I suspect it to be an error in the way VTK parses ASCII floating point
values. I assume that there is a simple fix. I apologize if I should not be
cross posting:

I'm not sure whether I should be emailing the ParaView or VTK lists (or
maybe both?), as the problem crashes ParaView but the error is thrown from
line 348 of VTK/IO/vtkXMLStructuredDataReader.cxx,

     vtkErrorMacro("Error reading extent "
                  << this->SubExtent[0] << " " << this->SubExtent[1] << " "
                   << this->SubExtent[2] << " " << this->SubExtent[3] << " "
                  << this->SubExtent[4] << " " << this->SubExtent[5]
                  << " from piece " << this->Piece);

After some extensive tests, I have noticed that the error only occurs when
the floating point data in an ASCII ImageData file has entries with
exponents less than or equal to -309 (I am using Float64 as the datatype).
In case it helps, the meta data for the file is

 <?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1">
 <ImageData WholeExtent="0 40 0 40 0 1" Origin="0 0 0.487805"
Spacing="0.0243902 0.0243902 0.0243902">
  <Piece Extent="0 40 0 40 0 1">
    <CellData Scalars="cell_scalars">
     <DataArray type="Float64" Name="cell_scalars" format="ascii">
 ...
     </DataArray>
   </CellData>
  </Piece>
 </ImageData>
</VTKFile>

The DataArray contained 40 lines of 40 floating point values, and I was
experimenting with changing the exponent on the first entry. For exponents
equal to -308 or greater, the file opens without an error. When I change it
to -309 or less, an error is thrown when clicking "Apply" and ParaView
quickly crashes (thus I haven't been able to easily write down the full
error...).

I dug into the VTK code for a few minutes but was not able to locate the
exact source of the problem. Perhaps there is an overflow in the ASCII
parsing due to an assumption of a smaller exponent?

I can easily avoid this problem by thresholding my output to zero when it
is sufficiently small, but I though I would report the problem anyway.

Best Regards,
Jack Poulson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111220/77b32c3d/attachment.htm>


More information about the vtkusers mailing list