You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's build a custom GZip decoder to explore re-entrant decompression.
There are two ways to do re-entrant stream decoding of large zip files:
Seek to the relevant file and decode the gzipped data until a specific offset is reached. For remote files, this requires downloading potentially hundreds of gigabytes of data.
Seek to the last decoded gzip block and start directly there. This has very little overhead.
PHP has build-in functions for working with gzip compression, but they don't expose the internal decoder state such as the last block start or the current Huffman code dictionary. However, the decompression can only continue from an arbitrary offset if we have that state. The first decompression method listed above simply recomputes it. The second method saves that work by restoring the state directly.
Therefore, to support resuming zip / gzip processing, we need a custom-built GZip decoder capable of exposing and restoring its internal state.
Let's build a custom GZip decoder to explore re-entrant decompression.
There are two ways to do re-entrant stream decoding of large zip files:
PHP has build-in functions for working with gzip compression, but they don't expose the internal decoder state such as the last block start or the current Huffman code dictionary. However, the decompression can only continue from an arbitrary offset if we have that state. The first decompression method listed above simply recomputes it. The second method saves that work by restoring the state directly.
Therefore, to support resuming zip / gzip processing, we need a custom-built GZip decoder capable of exposing and restoring its internal state.
A part of #1894
The text was updated successfully, but these errors were encountered: