Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01af5431 authored by Akilesh Kailash's avatar Akilesh Kailash
Browse files

snapuserd: typecast cow_op->new_block to uint64_t



On 32-bit devices, cow_op->new_block * BLOCK_SZ can overflow.

Bug: 376978542
Test: snapuserd_test on 32-bit device
1: Initiate merge on partition > 4GB.
2: Verify no overflow.

Change-Id: I4efc24891e0b330505ddf59b7db7716f054cf9c4
Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
parent a5560db8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ int MergeWorker::PrepareMerge(uint64_t* source_offset, int* pending_ops,
                break;
            }

            *source_offset = cow_op->new_block * BLOCK_SZ;
            *source_offset = static_cast<uint64_t>(cow_op->new_block) * BLOCK_SZ;
            if (!checkOrderedOp) {
                replace_zero_vec->push_back(cow_op);
                if (cow_op->type() == kCowReplaceOp) {
@@ -74,7 +74,7 @@ int MergeWorker::PrepareMerge(uint64_t* source_offset, int* pending_ops,
                    break;
                }

                uint64_t next_offset = op->new_block * BLOCK_SZ;
                uint64_t next_offset = static_cast<uint64_t>(op->new_block) * BLOCK_SZ;
                if (next_offset != (*source_offset + nr_consecutive * BLOCK_SZ)) {
                    break;
                }