EPPlus usage
Commercial use (I have a commercial license)
Environment
Windows
Epplus version
7.5.2
Spreadsheet application
Excel
Description
When the ExcelPackage (zip) itself is using DataDescriptor headers, but a file in the package happens to contain the DataDescriptor header byte signature (0x08074b50) in the compressed bytes of the file itself, the logic in OfficeOpenXml.Package.Ionic.Zip.ZipEntry::ReadHeader is incorrectly incrementing the _LengthOfTrailer value by 16 (or 24 for Zip64 entries) for every iteration of the while (wantMore) loop. It should instead just be assigning the value of 16 (or 24 for Zip64 entries) to _LengthOfTrailer, not incrementing.
In my case, the wantMore loop was iterated over twice and the _LengthOfTrailer value was set to 32, when it should have been set to 16 for the single DataDescriptor header at the end of the compressed bytes. This caused it to skip the LocalEntry header of the next entry and fail to process the file with a BadReadException.
EPPlus usage
Commercial use (I have a commercial license)
Environment
Windows
Epplus version
7.5.2
Spreadsheet application
Excel
Description
When the ExcelPackage (zip) itself is using DataDescriptor headers, but a file in the package happens to contain the DataDescriptor header byte signature
(0x08074b50)in the compressed bytes of the file itself, the logic inOfficeOpenXml.Package.Ionic.Zip.ZipEntry::ReadHeaderis incorrectly incrementing the_LengthOfTrailervalue by 16 (or 24 for Zip64 entries) for every iteration of thewhile (wantMore)loop. It should instead just be assigning the value of 16 (or 24 for Zip64 entries) to_LengthOfTrailer, not incrementing.In my case, the
wantMoreloop was iterated over twice and the_LengthOfTrailervalue was set to 32, when it should have been set to 16 for the single DataDescriptor header at the end of the compressed bytes. This caused it to skip the LocalEntry header of the next entry and fail to process the file with aBadReadException.