From 572abbb81cfa12cddf742fa35cd8a4b9eebdc7d1 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 22 Feb 2018 15:40:39 -0800 Subject: Remove the assumption of target chunk size in imgdiff In the split mode of imgdiff, we used to assume that the size of a split target chunk is always greater than the blocksize i.e. 4096. This may lead to the following assertion failure: I0221 04:57:33.451323 818464 common.py:205 imgdiff F 02-21 04:57:33 821203 821203 imgdiff.cpp:999] Check failed: tgt_size >= BLOCK_SIZE (tgt_size=476, BLOCK_SIZE=4096) This CL removes the assumption and handles the edge cases. Test: generate and verify the incremental update for TFs in the bug; unit test passes Bug: 73757557 Bug: 73711365 Change-Id: Iadbb4ee658995f5856cd488f3793980881a59620 --- applypatch/include/applypatch/imgdiff_image.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'applypatch/include') diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h index 0f74420f0..084807237 100644 --- a/applypatch/include/applypatch/imgdiff_image.h +++ b/applypatch/include/applypatch/imgdiff_image.h @@ -265,8 +265,9 @@ class ZipModeImage : public Image { std::vector& split_src_ranges, size_t total_tgt_size); // Construct the dummy split images based on the chunks info and source ranges; and move them into - // the given vectors. - static void AddSplitImageFromChunkList(const ZipModeImage& tgt_image, + // the given vectors. Return true if we add a new split image into |split_tgt_images|, and + // false otherwise. + static bool AddSplitImageFromChunkList(const ZipModeImage& tgt_image, const ZipModeImage& src_image, const SortedRangeSet& split_src_ranges, const std::vector& split_tgt_chunks, -- cgit v1.2.3