From 574566550941aec56611f79d589bb4200b4b5b48 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 10 May 2012 18:04:27 -0500 Subject: [PATCH] gem5: assert before indexing intro arrays to verify bounds --- src/dev/arm/gic.cc | 2 ++ src/mem/abstract_mem.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/src/dev/arm/gic.cc b/src/dev/arm/gic.cc index f686c2a13..94719f86f 100644 --- a/src/dev/arm/gic.cc +++ b/src/dev/arm/gic.cc @@ -193,10 +193,12 @@ Gic::readDistributor(PacketPtr pkt) pkt->set(int_p[int_num]); break; case 2: + assert((int_num + 1) < (SGI_MAX + PPI_MAX)); pkt->set(int_p[int_num] | int_p[int_num+1] << 8); break; case 4: + assert((int_num + 3) < (SGI_MAX + PPI_MAX)); pkt->set(int_p[int_num] | int_p[int_num+1] << 8 | int_p[int_num+2] << 16 | diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc index 13a1183a2..1b28a2319 100644 --- a/src/mem/abstract_mem.cc +++ b/src/mem/abstract_mem.cc @@ -390,6 +390,7 @@ AbstractMemory::functionalAccess(PacketPtr pkt) } else if (pkt->isPrint()) { Packet::PrintReqState *prs = dynamic_cast(pkt->senderState); + assert(prs); // Need to call printLabels() explicitly since we're not going // through printObj(). prs->printLabels(); -- 2.30.2