gem5: assert before indexing intro arrays to verify bounds
This commit is contained in:
@@ -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 |
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user