-
Notifications
You must be signed in to change notification settings - Fork 165
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
Panic while reading xls #481
Comments
It seems that the VBA script was the issue, I removed it and now the xls file parses without issue. |
Can you provide a test case to investigate the issue? |
Yes sure, I will see if I can remove everything sensitive in the xls and upload it here. |
I am trying to remove all the confidential information, but is not easy. But the issue seems to be related to whitespace in VBA script. If I add a newline in the VBA script the parsing will succeed every time, but if I add too many newlines I get the error at line 362 in cfb.rs consistently. There are two different failing behaviors, either it fails and left is always 2 or it fails and left is always 0. |
If the issue is solely in the VBA script, it should be feasible to extract it using the rust-cfb crate into a separate CFB file. If after doing that |
Okay thanks, I will try that. I will also keep working on getting an example xls w/o confidential info.. |
@sftse Can you give example on how to do that using rust-cfb? |
|
Thanks for that source code. I ran basically the same but added the xls read from calamine afterwards and it still gives the same error, use std::fs::File;
use calamine::{open_workbook, Xls};
fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
let in_path = "foo.xls";
let out_path = "bar.xls";
let mut original = cfb::open(in_path)?;
let version = original.version();
let out_file = File::create(out_path).unwrap();
let mut duplicate = cfb::CompoundFile::create_with_version(version, out_file)?;
let mut stream_paths = Vec::<std::path::PathBuf>::new();
for entry in original.walk() {
if entry.path().to_str().unwrap().contains("VBA") {
if entry.is_storage() {
if !entry.is_root() {
duplicate.create_storage(entry.path())?;
}
duplicate.set_storage_clsid(entry.path(), entry.clsid().clone())?;
} else {
stream_paths.push(entry.path().to_path_buf());
}
}
}
for path in stream_paths.iter() {
std::io::copy(
&mut original.open_stream(path)?,
&mut duplicate.create_new_stream(path)?,
)?;
}
let _: Xls<_> = open_workbook("bar.xls")?;
Ok(())
}
|
This reduced cfb file should have most of the sensitive parts removed. If you look through the remaining information and find it acceptable to publish, can you upload it as a test case? |
Hi When I try to open a workbook on one of my xls files I get the following error.
Does this mean that the excel file is broken or why is it crashing?
The text was updated successfully, but these errors were encountered: