]> git.proxmox.com Git - mirror_edk2.git/commit
BaseTools/Brotli: Fix compressed data loss issue
authorChen, Christine <Yuwei.Chen@intel.com>
Fri, 14 May 2021 06:04:44 +0000 (14:04 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 17 May 2021 03:45:13 +0000 (03:45 +0000)
commit9cd854e19de230cdbf5b3781d3b686861cf0bc2f
treee7deb0e04310efce7013ad844362e8aa1518d5a2
parente0cb5e1814a67bb12dd476a72d1698350633bcbb
BaseTools/Brotli: Fix compressed data loss issue

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2946

Currenly, when using the Brotli tool to compress data, the output
compressed binary file does not record complete compressed data
when size of input file is too large, which makes the data loss and
will trigger decompress-check issue.

The Brotli document mentioned:
The brotli tool use BrotliEncoderCompressStream method to compresses
input stream to output stream. Under some circumstances (e.g. lack of
output stream capacity) the BrotliEncoderOperation would require
several calls to BrotliEncoderCompressStream. The method must be
called again until both input stream is depleted and encoder has no
more output after the method is called.

This patch fixes this issue based on the Brotli document.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/C/BrotliCompress/BrotliCompress.c