ironfede / openmcdf

Microsoft Compound File .net component - pure C# - netstandard 2.0
Mozilla Public License 2.0
309 stars 76 forks source link

Infinite loop reading data in the following doc file #75

Closed hughbe closed 1 year ago

hughbe commented 3 years ago

In the following file, opening the stream "\001CompObj" we loop forever here Screenshot 2020-11-25 at 12 31 17

mediationform.doc.zip

ironfede commented 1 year ago

Sorry for the delayed response and thank you @hughbe for your report. File is corrupted. Specifically Ministeam FAT has a cyclic reference in sector 0. I've checked with other software (commercial ones) this file and it "seems" to be opened correctly. If you try to modify corrupted stream (\u0001CompObj) you will find that strange things happen since sector chain that should be closed by a marker in the minifat has a cycle reference and data are "spread" among wrong sectors. I've added an option to Structured Storage Explorer to enable File Validation but I can't assure the correctness of operations on such a file.

I've added a test and your attached file to solution test files to verify validation check.

Many Thanks and sorry again. Best Regards, Federico