tsolomko / SWCompression

A Swift framework for working with compression, archives and containers.
MIT License
233 stars 39 forks source link

Integer Overflow in BZip2 Decode #21

Closed elihwyma closed 3 years ago

elihwyma commented 3 years ago

Swift runtime failure: arithmetic overflow Line 214 of BZip2.swift

The Packages file causing issues can be downloaded here

tsolomko commented 3 years ago

Thank you for your report.

I fixed this issue, the fix will be released in 4.5.9.

I have one question though. The issue is related to this statement from wikipedia: "While the specification theoretically allows for runs of length 256–259 to be encoded, the reference encoder will not produce such output". The implementation in SWCompression relied on this assumption that run lengths will be only up to 255, which the file you provided proves to be incorrect.

So I am curious: do you know by any chance what program was used to produce (compress) this file?

elihwyma commented 3 years ago

Thanks for the fix

I have no idea what was used to create it. It came from an APT repo