diff options
author | Ali Saidi <Ali.Saidi@ARM.com> | 2012-05-10 18:04:27 -0500 |
---|---|---|
committer | Ali Saidi <Ali.Saidi@ARM.com> | 2012-05-10 18:04:27 -0500 |
commit | 574566550941aec56611f79d589bb4200b4b5b48 (patch) | |
tree | f5af4f86f65cd107fde5bb808b0f1d3b0f17c50b | |
parent | 4f66bcdd2e2cf983f66fe745eaa27698e90d0d60 (diff) | |
download | gem5-574566550941aec56611f79d589bb4200b4b5b48.tar.xz |
gem5: assert before indexing intro arrays to verify bounds
-rw-r--r-- | src/dev/arm/gic.cc | 2 | ||||
-rw-r--r-- | src/mem/abstract_mem.cc | 1 |
2 files changed, 3 insertions, 0 deletions
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<uint8_t>(int_p[int_num]); break; case 2: + assert((int_num + 1) < (SGI_MAX + PPI_MAX)); pkt->set<uint16_t>(int_p[int_num] | int_p[int_num+1] << 8); break; case 4: + assert((int_num + 3) < (SGI_MAX + PPI_MAX)); pkt->set<uint32_t>(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<Packet::PrintReqState*>(pkt->senderState); + assert(prs); // Need to call printLabels() explicitly since we're not going // through printObj(). prs->printLabels(); |