ironfede / openmcdf

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

Transitioning from Mini sectors to normal sectors is wrong #2

Closed TimonChristl closed 7 years ago

TimonChristl commented 7 years ago

The compound file binary specification says that a file must be stored using normal sectors when the size is equal to or larger than 4096. The current code uses the condition "greater than" which is wrong (CompoundFile.cs:2103 and following, should be >= instead of >).

Testcase: grow a CFStream that is less than 4096 to exactly 4096 bytes in size, commit and observe that the file contents are then messed up.

ironfede commented 7 years ago

Thank you for your precise report. Your proposed solution has been included in 2.1.2 release. Best Regards Federico