Closed f1nzer closed 2 years ago
It is the only fix that it needed?
What about the place where Clippit copy from old part to new part https://github.com/sergey-tihon/Clippit/blob/master/OpenXmlPowerTools/PowerPoint/FluentPresentationBuilder.cs#L889-L890
Hash calculation is the first place where the data is accessed.
NetFramework-only details:
Part.GetStream()
returns ZipIOModeEnforcingStream
that uses ProgressiveCrcCalculatingStream
as a base (inner) stream. This inner stream is reused all the time while the parent stream can be disposed/etc. That's why only initial `SetLength" is required and after that Crc calculation will be disabled for every other stream-related operation.
Thank you for the fix @f1nzer !
Fixes #55
FileFormatException
is thrown only on classic NetFramework.The root cause of this exception is that OpenXmlPart's content is corrupted. That's why
ProgressiveCrcCalculatingStream
throws exception during Crc32 validation check. As a hacky workaroundStream.SetLength(...)
is used to disable crc validation.CanSeek
is used to prevent bad situations and reduce unnecessary calls. Opposite to that RuntimeInformation.FrameworkDescription could be used to determine the NetFramework in runtime.