1024jp / GzipSwift

Swift package that enables gzip/gunzip Data using zlib
MIT License
533 stars 132 forks source link

Fix random runtime crash processing discontiguous data #24

Closed banjun closed 6 years ago

banjun commented 6 years ago

minimum changes to fix #22

This PR copies self into contiguous data before deflating and inflating, regardless of whether self is contiguous or discontiguous. The defensive patch consumes more temporary memory. It's better than random runtime crash.

I could not add tests for that as I saw the crashs randomly on devices and not on the simulator.

Alternative fixes:

Although I think about other fixes, they need some more work.

1024jp commented 6 years ago

👍 LGTM