From ff75c230860ff3e88c1e73cfcc62270d76af29bc Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Fri, 4 Mar 2016 15:23:34 -0800 Subject: [PATCH] releasetools: Fix the bug in AssertSequenceGood. We use a bitset for blocks in the target image to assert a block hasn't been touched before reading. Skip checking the blocks that are in the source image only. Bug: 27556903 Change-Id: I3a77292da673c813bd20d8dc177ff36419d8ecae (cherry picked from commit dca2200c8aa09b08ba0d37410a7826b737caecf2) --- tools/releasetools/blockimgdiff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py index 25d27436e..625dca2c8 100644 --- a/tools/releasetools/blockimgdiff.py +++ b/tools/releasetools/blockimgdiff.py @@ -771,7 +771,10 @@ class BlockImageDiff(object): x = x.subtract(sr) for s, e in x: - for i in range(s, e): + # Source image could be larger. Don't check the blocks that are in the + # source image only. Since they are not in 'touched', and won't ever + # be touched. + for i in range(s, min(e, self.tgt.total_blocks)): assert touched[i] == 0 # Check that the output blocks for this transfer haven't yet -- 2.11.0