Commit 968dfc54 authored by Myeongjin Cho's avatar Myeongjin Cho Committed by Commit Bot

Fix an assert to check the maximum compressed size of each MSZIP block

The maximum compressed size of each MSZIP block is 32k + 12 bytes.
So that means the size can be 32k + 12 bytes.
However, the assert checks as follows.

assert compressed_size < chunk_size + 12

Reference : https://msdn.microsoft.com/en-us/library/ee178063(v=exchg.80).aspx

Bug: None
Change-Id: I0d991be2909f4447144fccad83155c5967382557
Reviewed-on: https://chromium-review.googlesource.com/1074768
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567243}
parent 750eddc5
......@@ -591,6 +591,7 @@ Mohammed Wajahat Ali Siddiqui <wajahat.s@samsung.com>
Mohan Reddy <mohan.reddy@samsung.com>
Mohit Bhalla <bhallam@amazon.com>
Mrunal Kapade <mrunal.kapade@intel.com>
Myeongjin Cho <myeongjin.cho@navercorp.com>
Myles C. Maxfield <mymax@amazon.com>
Myung-jong Kim <mjkim610@gmail.com>
Nagarajan Narayanan <nagarajan.n@samsung.com>
......
......@@ -176,7 +176,7 @@ def WriteCab(output_file, input_file, cab_stored_filename, input_size,
# last block in a folder may be smaller. A two-byte MSZIP signature precedes
# the compressed encoding in each block, consisting of the bytes 0x43, 0x4B.
# The maximum compressed size of each MSZIP block is 32k + 12 bytes."
assert compressed_size < chunk_size + 12
assert compressed_size <= chunk_size + 12
output_file.write(struct.pack(CFDATA, 0, compressed_size, len(chunk)))
output_file.write('\x43\x4b') # MSZIP magic block header.
output_file.write(compressed)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment