summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryixuanjiang <yixuanjiang@google.com>2023-10-03 20:16:55 +0800
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-10-12 02:37:17 +0000
commit6c07bf70500e2163fb6654a16780eabe63000d12 (patch)
tree1cbd46c727360e143cbf417b8d7232ee77069bcd
parent89b5a47bfcce5de1d5a885087dde90d4c97f858e (diff)
downloadaoc-android-gs-bluejay-5.10-android14-qpr1.tar.gz
when coredump is corrupt, the value of num_sections from ramdump_header may larger than the number of sections. Out of range access will cause the KP. Bug: 302929196 Change-Id: I423886cb8223617d84cf1b21231a914c70a30dd2 Signed-off-by: yixuanjiang <yixuanjiang@google.com>
-rw-r--r--aoc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/aoc.c b/aoc.c
index b17a7c0..14e2ac9 100644
--- a/aoc.c
+++ b/aoc.c
@@ -2556,6 +2556,9 @@ static struct aoc_section_header *find_ramdump_section(struct aoc_ramdump_header
{
int i;
+ if (ramdump_header->num_sections != RAMDUMP_NUM_SECTIONS)
+ return NULL;
+
for (i = 0; i < ramdump_header->num_sections; i++)
if (ramdump_header->sections[i].type == section_type)
return &ramdump_header->sections[i];