Merge "Fix a bug where small manifest isn't read" am: 62582263a2 am: 6750cd8b02
Original change: https://android-review.googlesource.com/c/platform/development/+/1792911 Change-Id: If724cf9d9bad6143f0534b5cf5512b5b9f5a23be
This commit is contained in:
@@ -72,18 +72,20 @@ class OTAPayloadBlobWriter extends zip.Writer {
|
|||||||
// Once the prefixLength is non-zero, the address of manifest and signature
|
// Once the prefixLength is non-zero, the address of manifest and signature
|
||||||
// become known and can be read in. Otherwise the header needs to be read
|
// become known and can be read in. Otherwise the header needs to be read
|
||||||
// in first to determine the prefixLength.
|
// in first to determine the prefixLength.
|
||||||
if (this.prefixLength > 0) {
|
if (this.offset >= _PAYLOAD_HEADER_SIZE) {
|
||||||
if (this.offset >= this.prefixLength) {
|
|
||||||
await this.payload.readManifest(this.blob)
|
|
||||||
await this.payload.readSignature(this.blob)
|
|
||||||
}
|
|
||||||
} else if (this.offset >= _PAYLOAD_HEADER_SIZE) {
|
|
||||||
await this.payload.readHeader(this.blob)
|
await this.payload.readHeader(this.blob)
|
||||||
this.prefixLength =
|
this.prefixLength =
|
||||||
_PAYLOAD_HEADER_SIZE
|
_PAYLOAD_HEADER_SIZE
|
||||||
+ this.payload.manifest_len
|
+ this.payload.manifest_len
|
||||||
+ this.payload.metadata_signature_len
|
+ this.payload.metadata_signature_len
|
||||||
return
|
console.log(`Computed metadata length: ${this.prefixLength}`);
|
||||||
|
}
|
||||||
|
if (this.prefixLength > 0) {
|
||||||
|
console.log(`${this.offset}/${this.prefixLength}`);
|
||||||
|
if (this.offset >= this.prefixLength) {
|
||||||
|
await this.payload.readManifest(this.blob)
|
||||||
|
await this.payload.readSignature(this.blob)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// The prefix has everything we need (header, manifest, signature). Once
|
// The prefix has everything we need (header, manifest, signature). Once
|
||||||
// the offset is beyond the prefix, no need to move on.
|
// the offset is beyond the prefix, no need to move on.
|
||||||
|
|||||||
Reference in New Issue
Block a user