mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Validate number of steps specified in permutation
A permutation that specifies more steps than defined causes isolationtester to crash, so avoid that. Using less steps than defined should probably not be a problem, but no spec currently does that.
This commit is contained in:
parent
1b9dea04b5
commit
50363c8f86
@ -395,6 +395,12 @@ run_named_permutations(TestSpec * testspec)
|
|||||||
Permutation *p = testspec->permutations[i];
|
Permutation *p = testspec->permutations[i];
|
||||||
Step **steps;
|
Step **steps;
|
||||||
|
|
||||||
|
if (p->nsteps != nallsteps)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "invalid number of steps in permutation %d\n", i + 1);
|
||||||
|
exit_nicely();
|
||||||
|
}
|
||||||
|
|
||||||
steps = malloc(p->nsteps * sizeof(Step *));
|
steps = malloc(p->nsteps * sizeof(Step *));
|
||||||
|
|
||||||
/* Find all the named steps from the lookup table */
|
/* Find all the named steps from the lookup table */
|
||||||
@ -404,7 +410,8 @@ run_named_permutations(TestSpec * testspec)
|
|||||||
sizeof(Step *), &step_bsearch_cmp));
|
sizeof(Step *), &step_bsearch_cmp));
|
||||||
if (steps[j] == NULL)
|
if (steps[j] == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "undefined step \"%s\" specified in permutation\n", p->stepnames[j]);
|
fprintf(stderr, "undefined step \"%s\" specified in permutation\n",
|
||||||
|
p->stepnames[j]);
|
||||||
exit_nicely();
|
exit_nicely();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user