1024jp / GzipSwift

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

Fix random runtime crash processing discontiguous data #24

Closed banjun closed 7 years ago

banjun commented 7 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 7 years ago

👍 LGTM