Skip to content
Snippets Groups Projects
  1. Apr 05, 2024
  2. Apr 01, 2024
  3. Mar 31, 2024
  4. Mar 27, 2024
  5. Mar 26, 2024
  6. Mar 25, 2024
  7. Mar 24, 2024
    • nina's avatar
      zstd: clean up and fix extraction · a74d1584
      nina authored
      The original logic was somewhat wrong. We should not be trying
      to repeatedly decompress the stream with the same input, as there
      is no guarantee it will safely advance the input all the way.
      
      Instead, we should call it once and then ask for more input if
      it has been advanced to the end. Regardless, we should return
      when the output buffer has been filled, and keep trying to get
      more input every time; zstd will eventually advance the input
      buffer so that we either get satisfactory data, an EOF, or an
      error.
      
      While at it, handle another edge case. The extraction generally
      works without it but just for robustness and to match what the
      documentation is saying; if decompressStream fully fills in an
      output buffer, there may be more data internally, so save that
      state and next time try getting that data to return it even if
      we get an EOF from the stream.
      
      If an output buffer is filled only partially, it means zstd has
      processed everything. In this case, this generally means an end
      of file, so the input buffer will have been fully advanced and
      we get an EOF from the wrapped stream on next iteration; since
      we got *some* data, we disregard this EOF and return the data.
      a74d1584
  8. Mar 23, 2024
Loading