aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2020-04-30 02:14:27 +0100
committerNikita Ioffe <ioffe@google.com>2020-04-30 16:56:32 +0100
commit66872e8dc9f4b0aa5fa1eca970430be003003a7b (patch)
treeaf338c6fe470f4ecf8d78cb1d28caf2edbb6bb9a
parentb73cea24f89621456c950b102d475ffbd4227334 (diff)
downloadavb-android11-dev.tar.gz
Test: put corrupted apex on /system_ext/apex Test: verified it's not activated Test: atest --host libavb_host_unittest Bug: 146516087 Change-Id: Ic85cbd580b4a5e6514db68359e78fae7455e0fb8
-rw-r--r--libavb/avb_descriptor.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavb/avb_descriptor.c b/libavb/avb_descriptor.c
index cfc2aac..7030a40 100644
--- a/libavb/avb_descriptor.c
+++ b/libavb/avb_descriptor.c
@@ -88,6 +88,10 @@ bool avb_descriptor_foreach(const uint8_t* image_data,
}
for (p = desc_start; p < desc_end;) {
+ if (p + sizeof(AvbDescriptor) > desc_end) {
+ avb_error("Invalid descriptor length.\n");
+ goto out;
+ }
const AvbDescriptor* dh = (const AvbDescriptor*)p;
avb_assert_aligned(dh);
uint64_t nb_following = avb_be64toh(dh->num_bytes_following);