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:
- properly decompress block , subsequent blocks
- 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:
- 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.
- 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
Post a Comment