Skip to content

Commit fe12f67

Browse files
committed
Added check related to expression execution count parsing from command-line parameter.
1 parent 3cafa95 commit fe12f67

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/ParserBench.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ void Shootout(const std::string& sCaption,
258258
if (failure_count)
259259
{
260260
output(pRes, "DNQ List\n");
261+
261262
parser_index = 0;
263+
262264
for (auto it = results.begin(); it != results.end(); ++it)
263265
{
264266
const std::vector<Benchmark*>& vBench = it->second;
@@ -297,6 +299,7 @@ void Shootout(const std::string& sCaption,
297299
{
298300
output(pRes, "**** ERROR **** Excessive number of evaluation failures! [%d]\n\n",
299301
failure_count);
302+
300303
++excessive_failure_cnt;
301304
}
302305

@@ -367,7 +370,9 @@ void Shootout(const std::string& sCaption,
367370
for (std::size_t i = 0; i < vBenchmarks.size(); ++i)
368371
{
369372
Benchmark *pBench = vBenchmarks[i];
373+
370374
const std::map<std::string, std::string> &allFailures = pBench->GetFails();
375+
371376
if (!allFailures.empty())
372377
{
373378
output(pRes, " %-15s (%3d):\n",
@@ -437,7 +442,11 @@ int main(int argc, const char *argv[])
437442

438443
if (argc >= 2)
439444
{
440-
iCount = atoi(argv[1]);
445+
if (0 >= (iCount = atoi(argv[1])))
446+
{
447+
std::cout << "ERROR - Invalid number of iterations!\n";
448+
return 1;
449+
}
441450
}
442451

443452
if (argc >= 3)

0 commit comments

Comments
 (0)