changeset e68dd2ba4fa4 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e68dd2ba4fa4
description:
        gem5: assert before indexing intro arrays to verify bounds

diffstat:

 src/dev/arm/gic.cc      |  2 ++
 src/mem/abstract_mem.cc |  1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 69fad6658160 -r e68dd2ba4fa4 src/dev/arm/gic.cc
--- a/src/dev/arm/gic.cc        Thu May 10 18:04:27 2012 -0500
+++ b/src/dev/arm/gic.cc        Thu May 10 18:04:27 2012 -0500
@@ -193,10 +193,12 @@
             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 -r 69fad6658160 -r e68dd2ba4fa4 src/mem/abstract_mem.cc
--- a/src/mem/abstract_mem.cc   Thu May 10 18:04:27 2012 -0500
+++ b/src/mem/abstract_mem.cc   Thu May 10 18:04:27 2012 -0500
@@ -390,6 +390,7 @@
     } 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();
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to