summaryrefslogtreecommitdiff
path: root/verity
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-04-23 15:24:06 -0700
committerTao Bao <tbao@google.com>2018-04-24 10:40:54 -0700
commitff0d605f96afa79769fb025597e2424fe87a8439 (patch)
treeb311449e4bd81d4ab3ec31bf6a77fceb754f3257 /verity
parentca4bf1d719d93d5c57f4af7572d6700a57aff608 (diff)
downloadextras-ff0d605f96afa79769fb025597e2424fe87a8439.tar.gz
verity: Track the libsparse API change.
libsparse is updating the 'len' parameter, from 'int' to 'size_t', in the callback parameter of sparse_file_callback(). The value represents the chunk size, which could be legitimately larger than INT_MAX. Bug: 78432315 Test: `m dist` with aosp_marlin-userdebug Change-Id: I0c4b9465fd145b6a35d8228430362d25b8fd4c6e
Diffstat (limited to 'verity')
-rw-r--r--verity/build_verity_tree.cpp4
-rw-r--r--verity/fec/image.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/verity/build_verity_tree.cpp b/verity/build_verity_tree.cpp
index e841c20e..ad812ed8 100644
--- a/verity/build_verity_tree.cpp
+++ b/verity/build_verity_tree.cpp
@@ -90,7 +90,7 @@ int hash_blocks(const EVP_MD *md,
return 0;
}
-int hash_chunk(void *priv, const void *data, int len)
+int hash_chunk(void *priv, const void *data, size_t len)
{
struct sparse_hash_ctx *ctx = (struct sparse_hash_ctx *)priv;
assert(len % ctx->block_size == 0);
@@ -101,7 +101,7 @@ int hash_chunk(void *priv, const void *data, int len)
ctx->salt, ctx->salt_size, ctx->block_size);
ctx->hashes += s;
} else {
- for (size_t i = 0; i < (size_t)len; i += ctx->block_size) {
+ for (size_t i = 0; i < len; i += ctx->block_size) {
memcpy(ctx->hashes, ctx->zero_block_hash, ctx->hash_size);
ctx->hashes += ctx->hash_size;
}
diff --git a/verity/fec/image.cpp b/verity/fec/image.cpp
index 861ca601..58853cf5 100644
--- a/verity/fec/image.cpp
+++ b/verity/fec/image.cpp
@@ -77,7 +77,7 @@ static void calculate_rounds(uint64_t size, image *ctx)
ctx->rounds = fec_div_round_up(ctx->blocks, ctx->rs_n);
}
-static int process_chunk(void *priv, const void *data, int len)
+static int process_chunk(void *priv, const void *data, size_t len)
{
image *ctx = (image *)priv;
assert(len % FEC_BLOCKSIZE == 0);