Fix idsig for a large APK files
Bug: 210800944
Test: atest --test-mapping idsig
Change-Id: I74c42e384fadfb8363306a3ead91869d15f4f0da
diff --git a/idsig/src/hashtree.rs b/idsig/src/hashtree.rs
index 1ce2879..63f83ea 100644
--- a/idsig/src/hashtree.rs
+++ b/idsig/src/hashtree.rs
@@ -100,7 +100,7 @@
// and split it.
let prev = &levels[n - 1];
let cur_and_prev = &mut hash_tree[cur.start..prev.end];
- let (cur, prev) = cur_and_prev.split_at_mut(prev.start);
+ let (cur, prev) = cur_and_prev.split_at_mut(prev.start - cur.start);
let mut cur = Cursor::new(cur);
prev.chunks(block_size).for_each(|data| {
let h = hash_one_block(data, salt, block_size, algorithm);
@@ -200,7 +200,7 @@
#[test]
fn compare_with_golden_output() -> Result<()> {
// The golden outputs are generated by using the `fsverity` utility.
- let sizes = ["512", "4K", "1M", "10000000"];
+ let sizes = ["512", "4K", "1M", "10000000", "272629760"];
for size in sizes.iter() {
let input_name = format!("testdata/input.{}", size);
let mut input = File::open(&input_name)?;