MantisBT - VTK
View Issue Details
0013294VTK(No Category)public2012-07-04 11:392016-08-12 09:55
klaus triendl 
Cory Quammen 
highminorhave not tried
closedmoved 
5.8.0 
 
Release
crash
0013294: string arrays may cause vtkXMLUnstructuredGridWriter to produce corrupt vtu-files, which are unreadable or cause crash
When a string array is appended to the cell data of an unstructured grid, vtkXMLUnstructuredGridWriter may produce a corrupt vtu-file, depending on how long the strings are. I cannot tell at what length the issue shows up, but the longer the strings the sooner it happens.
Even very simple models with just 304 cells can be affected. It doesn't matter whether the cell data is compressed or not and whether the data is binary or appended. Only ascii works.

Please see attached zip file, which contains:
* a test cpp file displaying how I produce the vtu-files
* a test msvc2010 project
* the source and resulting vtu files

Notes worth to be mentioned:
* When loading the compressed vtu-files the following error is reported:
<error>
- ERROR: In ..\..\..\..\src\VTK\IO\vtkZLibDataCompressor.cxx, line 83
vtkZLibDataCompressor (00000000139D63E0): Decompression produced incorrect size.
Expected 27728 and got 27529


ERROR: In ..\..\..\..\src\VTK\IO\vtkXMLDataReader.cxx, line 545
vtkXMLUnstructuredGridReader (000000000B2F7ED0): Cannot read cell data array "strings" from PointData in piece 0. The data array in the element may be too short.
</error>
* when loading the uncompressed vtu-files then the reading application crashes in the template function vtkXMLDataReaderReadArrayValues<vtkArrayIteratorTemplate<vtkStdString>>


I detected the issue already in version 5.8.0, it's still active in 5.10.0 and in 6.0 (git #02aef09).
No tags attached.
related to 0013382closed T.J. Corona vtkXMLUnstructuredGridWriter: corrupted output for polyhedral cells in appended mode 
related to 0013860closed Chuck Atkins the vtkXMLUnstructuredGridWriter crashes on MacOSX 10.6.8 
related to 0013295closed Dave DeMarle vtkXMLUnstructuredGridReader cannot read vtu-files in ascii mode when a double data array contains INFINITE or MAX values 
zip vtk-xmlwriter-bug.zip (75,689) 2012-07-04 11:39
https://www.vtk.org/Bug/file/9223/vtk-xmlwriter-bug.zip
? None.vtp (516,242) 2013-08-22 04:35
https://www.vtk.org/Bug/file/9508/None.vtp
? Zlib.vtp (164,049) 2013-08-22 04:35
https://www.vtk.org/Bug/file/9509/Zlib.vtp
Issue History
2012-07-04 11:39klaus triendlNew Issue
2012-07-04 11:39klaus triendlFile Added: vtk-xmlwriter-bug.zip
2013-06-25 14:22Dave DeMarleRelationship addedchild of 0013860
2013-06-25 14:22Dave DeMarleRelationship deletedchild of 0013860
2013-06-25 14:22Dave DeMarleRelationship addedrelated to 0013860
2013-06-25 14:23Dave DeMarleRelationship addedrelated to 0013295
2013-06-25 14:24Dave DeMarleRelationship addedrelated to 0013382
2013-08-22 04:34EmmanuelNote Added: 0031491
2013-08-22 04:35EmmanuelFile Added: None.vtp
2013-08-22 04:35EmmanuelFile Added: Zlib.vtp
2015-08-18 10:25T.J. CoronaNote Added: 0035013
2015-08-18 10:25T.J. CoronaStatusbacklog => closed
2015-08-18 10:25T.J. CoronaAssigned To => T.J. Corona
2015-08-18 10:25T.J. CoronaResolutionopen => unable to reproduce
2015-08-18 10:25T.J. CoronaFixed in Version => 6.3.0
2015-12-16 09:23Cory QuammenAssigned ToT.J. Corona => Cory Quammen
2015-12-16 09:23Cory QuammenNote Added: 0035573
2015-12-16 09:23Cory QuammenStatusclosed => backlog
2015-12-16 09:23Cory QuammenResolutionunable to reproduce => reopened
2016-08-12 09:55Kitware RobotNote Added: 0037286
2016-08-12 09:55Kitware RobotStatusbacklog => closed
2016-08-12 09:55Kitware RobotFixed in Version6.3.0 =>
2016-08-12 09:55Kitware RobotResolutionreopened => moved

Notes
(0031491)
Emmanuel   
2013-08-22 04:34   
Hi
It seems to be the same problem I have with vtkXMLPolyDataWriter.
For some string attached to cells, if I use the Zlib compression, it produces a corrupted file, which gives this error when reading with paraview:
"
ERROR: In /builddir/build/BUILD/ParaView-3.98.1-source/VTK/IO/Core/vtkZLibDataCompressor.cxx, line 85
vtkZLibDataCompressor (0x4459a90): Decompression produced incorrect size.
Expected 2696 and got 2693

ERROR: In /builddir/build/BUILD/ParaView-3.98.1-source/VTK/IO/XML/vtkXMLDataReader.cxx, line 545
vtkXMLPolyDataReader (0x4457860): Cannot read cell data array "Names" from PointData in piece 0. The data array in the element may be too short.
"
Most of the time it works without problem. It depends on the string attached.
In my case if I associate the string "5" it works fine, if I put a character or string (like "5s") it fails. Both works when not using Zlib compression.
Files using and not using compression are attached. (Zlib.vtp and None.vtp)

vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();

writer->SetCompressorTypeToZLib();// using this generates Zlib.vtp
writer->SetCompressorTypeToNone();// using this generates None.vtp


thank you ;-)
(0035013)
T.J. Corona   
2015-08-18 10:25   
I cannot reproduce this problem in VTK6.3.
(0035573)
Cory Quammen   
2015-12-16 09:23   
I believe this is still a bug in VTK 7.0. I will follow up later.
(0037286)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

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