Check validity of allocation index when parsing data file.
authorMilian Wolff <mail@milianw.de>
Thu, 24 Mar 2016 21:33:36 +0000 (22:33 +0100)
committerMilian Wolff <mail@milianw.de>
Thu, 24 Mar 2016 21:33:36 +0000 (22:33 +0100)
accumulatedtracedata.cpp

index 0c4bbc2..485d704 100644 (file)
@@ -223,6 +223,9 @@ bool AccumulatedTraceData::read(istream& in)
                 if (!(reader >> allocationIndex.index)) {
                     cerr << "failed to parse line: " << reader.line() << endl;
                     continue;
+                } else if (allocationIndex.index >= allocationInfos.size()) {
+                    cerr << "allocation index out of bounds: " << allocationIndex.index << ", maximum is: " << allocationInfos.size() << endl;
+                    continue;
                 }
                 info = allocationInfos[allocationIndex.index];
             } else { // backwards compatibility