mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
PayloadWriter: Only set data_offset for operations that reference blobs
This fixes `data_offset` being set for `ZERO` and `DISCARD` operations, which prevents some images (eg. `ossi`) from being flashed due to update_engine's strict field validation. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This commit is contained in:
@@ -294,9 +294,10 @@ impl<W: Write> PayloadWriter<W> {
|
||||
// The blob must contain all data in sequential order with no gaps.
|
||||
for p in &mut header.manifest.partitions {
|
||||
for op in &mut p.operations {
|
||||
op.data_offset = Some(blob_size);
|
||||
|
||||
if let Some(length) = op.data_length {
|
||||
// The field must be left unset when the blob contains no
|
||||
// data for the operation.
|
||||
op.data_offset = Some(blob_size);
|
||||
blob_size += length;
|
||||
}
|
||||
}
|
||||
@@ -402,7 +403,8 @@ impl<W: Write> PayloadWriter<W> {
|
||||
/// [`InstallOperation::data_length`].
|
||||
pub fn begin_next_operation(&mut self) -> Result<bool> {
|
||||
if let Some(operation) = self.operation() {
|
||||
// ZERO/DISCARD operations will not have a length.
|
||||
// Only operations that reference data in the blob will have a
|
||||
// length set.
|
||||
if self.written < operation.data_length.unwrap_or(0) {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
|
||||
+2
-2
@@ -107,8 +107,8 @@ sections = [
|
||||
]
|
||||
hash.original.full = "929f892fbd70699cf7f118a119aac1ae1b86351e1ada17715666fa4401e63472"
|
||||
hash.original.stripped = "4eabaf79b6c2b5df305e3ecdc2b9570c0dd27350b4e8d6434584000c4989ff3d"
|
||||
hash.patched.full = "8e9cf3159e57d706047325a7b774dc2dc84f0d56baae100ad54c0c723b621469"
|
||||
hash.patched.stripped = "0b5dcdfdfea742bf6662b286ba260f8572a7b0081bb1129b7274c29214cdfb49"
|
||||
hash.patched.full = "3453b2eda97ca1ba7367fa9d0dd37b21a5065e2e57cc3bbe9a6f135349d42d0b"
|
||||
hash.patched.stripped = "1a41e435bdbf4302761e719e218e8682145644c0fe276739c3265f392adbd74d"
|
||||
hash.avb_images."boot.img" = "f5dc3b147c54589be8db00ca15257a3688424a9eb88bd9c2cec82ebf4f6bf859"
|
||||
hash.avb_images."recovery.img" = "a42c0bf4f023cd24394184a33ee113783a9c89a7cc4c0c582a5f72cc23b72309"
|
||||
hash.avb_images."vbmeta.img" = "c022cf79da301a8430af5c49704944c490707fa0306031fe3ea22c39ce4734f6"
|
||||
|
||||
Reference in New Issue
Block a user