diff options
author | Alvaro Herrera | 2012-01-11 21:46:18 +0000 |
---|---|---|
committer | Alvaro Herrera | 2012-01-11 21:48:59 +0000 |
commit | 50363c8f86f89fe611ba417575218978917f1ac0 (patch) | |
tree | 581d398647cf2f9141a763fcb5cdbdeba28b7404 /src/test/isolation/isolationtester.c | |
parent | 1b9dea04b5cd8b1b2f8041e4aece9d573f007eb1 (diff) |
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.
Diffstat (limited to 'src/test/isolation/isolationtester.c')
-rw-r--r-- | src/test/isolation/isolationtester.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index 38f1e78dc5c..1d339e9c577 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -395,6 +395,12 @@ run_named_permutations(TestSpec * testspec) Permutation *p = testspec->permutations[i]; 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 *)); /* Find all the named steps from the lookup table */ @@ -404,7 +410,8 @@ run_named_permutations(TestSpec * testspec) sizeof(Step *), &step_bsearch_cmp)); 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(); } } |