mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(android): require AVB vbmeta to follow the original image (#12271)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
1 parent
abba94101a
commit
447735c170
2 files changed
+23
No files matched your search
@@ -382,3 +382,22 @@ it("finds an AVB footer before the final boot page boundary", async () => {
|
||||
avb_vbmeta_size: 256,
|
||||
});
|
||||
});
|
||||
|
||||
it.each([1, 32])(
|
||||
"refuses vbmeta starting at original image end minus %i",
|
||||
async (overlap) => {
|
||||
const image = buildBootImage({
|
||||
version: 0,
|
||||
kernel: Buffer.alloc(64),
|
||||
ramdisk: Buffer.alloc(0),
|
||||
});
|
||||
const bytes = appendAvbFooter(image, {
|
||||
vbmeta: Buffer.alloc(16),
|
||||
vbmetaOffset: image.length - overlap,
|
||||
});
|
||||
const path = await writeCarrier("overlapping-original-image.img", bytes);
|
||||
await expect(scanCanonicalArtifactInventory(path)).rejects.toThrow(
|
||||
/AVB vbmeta overlaps the original boot image/u,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -1187,6 +1187,10 @@ const readAvbFooter = (input: {
|
||||
input.headerOccupied,
|
||||
input.components,
|
||||
);
|
||||
// vbmeta is appended after the original image, including any padding
|
||||
// within that image. Existing component checks name specific collisions.
|
||||
if (vbmetaSize > 0 && vbmetaOffset < originalImageSize)
|
||||
formatError("AVB vbmeta overlaps the original boot image");
|
||||
return {
|
||||
present: true,
|
||||
footerSize: AVB_FOOTER_SIZE,
|
||||
|
||||
Reference in new issue
Block a user