mdsteele / rust-msi

Rust library for reading/writing Windows Installer (MSI) files
MIT License
58 stars 11 forks source link

Failed to fill whole buffer #19

Open russellbanks opened 9 months ago

russellbanks commented 9 months ago

I had a user report an issue when my tool was reading an MSI:

To reproduce:

msi::open(r"path\to\CeVIO_AI_Setup_x64_(9.1.1.0).msi").unwrap();

This results in this error: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }

MSI Direct Download

CoolPlayLin commented 9 months ago

Hi @mdsteele

Any update on this issue?

mdsteele commented 9 months ago

Sorry for the slow reply; I finally took a look at this today. For starters, it seems like the msi crate could use some improvements in its error reporting. (-:

I did some debugging, and it looks like the immediate cause of the error is that the StringPoolBuilder is trying and failing to read data for a string of length 156999 (which seems suspiciously large). It looks like that file's _StringData table is 162121 bytes, but the total length of all strings referenced in its _StringPool table is larger, at 227657, which probably can't be right. So either there's something wrong with the string pool in that file, or more likely, the msi crate's string pool entry decoding has a bug. Maybe this is the same bug as #18?