Repository navigation
magiskboot: fix ZERO operation handling in payload extraction - #10282
Open
lingyicute wants to merge 1 commit into
Open
lingyicute wants to merge 1 commit into
lingyicute wants to merge 1 commit into
Conversation
In OTA payloads, InstallOperation::ZERO operations do not carry a data blob in the payload file, so data_offset and data_length are not set in the manifest. Checking data_length and data_offset before matching the operation type causes extraction to fail with "data length not found" whenever a ZERO operation is encountered. In addition, write_zeros() expects a byte count, so num_blocks must be multiplied by block_size.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two bugs when handling
InstallOperation::ZEROinextract_boot_from_payload:Handle
Type::ZERObefore readingdata_lengthanddata_offset:Per
update_metadata.proto,ZEROoperations only specifydst_extentsand do not have an associated data blob in the payload (data_offsetanddata_lengthareNone). Previously,extract_boot_from_payloadunconditionally unwrappeddata_lengthanddata_offsetat the beginning of the loop before checkingoperation.type_pb, causing extraction to fail withInvalid payload: data length not foundon any payload containing aZEROoperation.Multiply
num_blocksbyblock_sizewhen writing zeros:Extent.num_blocksis measured in blocks, whereasWriteExt::write_zerostakes the number of bytes to write. Previouslynum_blockswas passed directly as the byte length instead ofnum_blocks * block_size.