6 Commits
Author SHA1 Message Date
Kelvin Zhang 67386a2f62 Make bsdiff available in recovery
Change-Id: I9e96d475a52648e885925502be5801926d2764e3
2021-12-20 19:47:02 -08:00
Alex Deymo 7c4bb57f87 Handle more invalid patch header cases.
Added more unittests for checking invalid headers.

Bug: chromium:822821
Test: Added unittests
Change-Id: I649674c41f00395dbf63f53e2576f7b7b61116c3
2018-03-19 20:27:04 +01:00
Tianjie Xu 18480eb706 Implement a simple logger for bsdiff
The logger supports LOG & PLOG. It also adds a std::endl at the end of
the stream so that we don't need to add it manually at the callsite.

Test: run bsdiff and check the logs.
Change-Id: Ice94902a501532ceaeb480c3576e752e435cab70
2017-11-30 12:28:06 -08:00
Tianjie Xu b4cba64184 Implement a new bsdiff format
Add a new BSDF2 format that allows compression of ctrl/diff/extra streams
with different algorithms. The compression algorithm supported for now is
bz2 and brotli. This new format is similar to the legacy "BSDIFF40" format
except for the magic headers.

File format:
0       8    magic header
8       8    X
16      8    Y
24      8    new_file_size
32      X    compressed control block
32+X    Y    compressed diff block
32+X+Y  ???  compressed extra block

The magic header for BSDF2 format:
0 5 BSDF2
5 1 compressed type for control stream
6 1 compressed type for diff stream
7 1 compressed type for extra stream

Bug: 34220646
Test: unittest pass
Change-Id: I6eb0867e88476dbc4a4b7be609783f8c8a0a41cd
2017-11-16 14:46:37 -08:00
Tianjie Xu 4d10c3efd7 Add a brotli decompressor in bsdiff
This CL implements the brotli decompressor used in PatchReader. Also
extract the CompressorType and patch's MagicHeader to a common header file.

Bug: 34220646
Test: Run bsdiff/bspatch with brotli compressor/decompressor over a list
of files from angler's system image.

Change-Id: I76e11168075c6481490ffbc025ec4ca81e828732
2017-11-14 14:36:55 -08:00
Tianjie Xu 6528812247 Add an interface for bspatch reader
Add a wrapper class to separate the patch read from data stream
decompression. Therefore, bspatch will be able to process the patch
that is compressed with various tools.

Test: unittest pass
Change-Id: I5214e0451bde80366e8a70b960703afb2b2a7d97
2017-10-26 14:50:34 -07:00