Skip to content
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

XLS is detected as application/x-ole-storage, not application/vnd.ms-excel #108

Open
justanotheranonymoususer opened this issue Feb 4, 2025 · 1 comment

Comments

@justanotheranonymoususer

Hi, there are 2 problems here:

XLS file not being detected by cfb dependency, because it can't handle the partial buffer of 8192 bytes. open here:

if let Ok(file) = cfb::CompoundFile::open(Cursor::new(buf)) {

returns:

kind: InvalidData, error: "Malformed FAT (FAT has 66 entries, but file has only 15 sectors)"

Not sure what's the best solution here, in this doc I found they suggest to look at offset 512 to determine the doc type such as doc/xls/ppt:
https://sceweb.sce.uhcl.edu/abeysekera/itec3831/labs/FILE%20SIGNATURES%20TABLE.pdf

Second problem is that it falls back to MSI, but it has nothing to do with MSI or installers, so perhaps MSI should have a stricter check.

CreditCard.zip

@justanotheranonymoususer
Copy link
Author

Here's a working implementation if you want to borrow it:
https://github.com/mmalecot/file-format/blob/bb09c0f71415a22909ae41fa6bc6521b06367375/src/readers.rs#L171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant