zlib - Resume DEFLATE decompression from flush point -


this question specific deflate algorithm, relates gzip , zlib.

suppose have gzip file know has several flush points in file. of made z_sync_flush , other z_full_flush. if scan through file, can find flush points because follow pattern of 0000ffff.

i know can resume decompression @ z_full_flush points because information needed decompress available (ie: dictionary reset). however, if try decompress z_sync_flush, "zlib.error: error -3 while decompressing: invalid distance far back" error.

the question this: if try decompress z_sync_flush point, guaranteed either:

  1. properly decompress block , subsequent blocks
  2. fail "distance far" error

in other words, guaranteed never silently decompress bad data (i'm not talking crc32 check @ end of gzip, whether zlib loudly complain)?

assumptions:

  1. assume able identify flush points perfectly. let's pretend don't mis-identify random bits sync marker nor pattern happens appear in type 0 block. unrealistic, assume it's true.
  2. assume file never corrupted , legitimate gzip file.

if z_sync_flush results in subsequent stream not give distance-too-far error, is, accident, equivalent , indistinguishable z_full_flush.

i not expect happen often.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -