-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty section handling #50
Comments
Thank you for bringing this up, @DanW97! I want to clarify: is the issue in reading base64 encoded VTP files produced by PyVista using vtkio? If so, could you paste the output when running vtkio with logging set to "trace"? |
Yes, that's correct.
I couldn't find the original file I had when creating this issue, so I've created another that reproduces the issue, this time with Debug:
Release
In With a quick for piece in pieces {
println!("{:?}". piece);
} it shows that the ASCII file (exact same as the binary file but setting
In case you want to try and reproduce locally, I've attached the script and dependencies I was using to generate the files. |
I've noticed that PyVista includes all possible sections for PolyData files, and it isn't readily apparent how this can be prevented in a sane manner.
As an example, this is a dataset with the following attributes:
NumberOfPoints="6" NumberOfVerts="6" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0"
In binary:
And in ASCII (as you can see - empty, I'm not fully certain on what the AAAAAACAAAAAAAAA entries for the binary file mean):
Running in debug mode, I see that
xml.rs
, line 1900 tries to execute an overflowing subtraction. In release mode, the silent overflow, to me, doesn't seem like a good thing. So I am wondering what the best approach to handling this case is? I've added a couple of lines toxml.rs
that basically makesdecompress()
return early with a vector containing a singleu8
set to 0. From what I can tell, I don't think any other code needs modification. From some quick testing of the example files that have the snippets I've shared above, it appears to work as intended - output ispolys: Some(XML { connectivity: [], offsets: [] })
for instance.My reasoning is that if a read is requested, we should try and read everything that we can correctly and return the exact contents in the file (except if invalid data is present). Full disclosure - I'm in 2 minds whether this should be an error or left to the user to handle the fact that they have empty sections - I'm leaning more towards the latter because an empty section, to me, doesn't seem like invalid data necessarily.
I'm curious about your thoughts on this type of case.
The text was updated successfully, but these errors were encountered: