From: Ali Saidi Date: Thu, 10 May 2012 23:04:27 +0000 (-0500) Subject: gem5: assert before indexing intro arrays to verify bounds X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=574566550941aec56611f79d589bb4200b4b5b48;p=gem5.git gem5: assert before indexing intro arrays to verify bounds --- 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();