Merge "makefile: Add VB ATTEST and OSVERSION IN BOOTIMAGE flags"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 09ba226..0706731 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1167,8 +1167,16 @@
#if DEVICE_TREE
dt_actual = ROUND_TO_PAGE(hdr->dt_size, page_mask);
+ if (UINT_MAX < ((uint64_t)kernel_actual + (uint64_t)ramdisk_actual+ (uint64_t)dt_actual + page_size)) {
+ dprintf(CRITICAL, "Integer overflow detected in bootimage header fields at %u in %s\n",__LINE__,__FILE__);
+ return -1;
+ }
imagesize_actual = (page_size + kernel_actual + ramdisk_actual + dt_actual);
#else
+ if (UINT_MAX < ((uint64_t)kernel_actual + (uint64_t)ramdisk_actual + page_size)) {
+ dprintf(CRITICAL, "Integer overflow detected in bootimage header fields at %u in %s\n",__LINE__,__FILE__);
+ return -1;
+ }
imagesize_actual = (page_size + kernel_actual + ramdisk_actual);
#endif