summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-18 14:01:46 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-18 14:01:46 (GMT)
commiteff13ebf336a87e1e572ab89dea7a669674c20bc (patch)
treec9806988b0c18c9393d3f01b36803ad3a32efdda
parentb4de56386ca86fe8485c58f6b3e9bfc21949be02 (diff)
parent7eddefd8f1375c5c6f2fbe6e0e51f14bdc1f8886 (diff)
downloadCMake-eff13ebf336a87e1e572ab89dea7a669674c20bc.zip
CMake-eff13ebf336a87e1e572ab89dea7a669674c20bc.tar.gz
CMake-eff13ebf336a87e1e572ab89dea7a669674c20bc.tar.bz2
Merge topic 'coverity-generated-tests'
7eddefd TestDriver.cxx.in: Untrusted array index read.
-rw-r--r--Templates/TestDriver.cxx.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index f4510bb..03916bf 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -137,6 +137,13 @@ int main(int ac, char *av[])
{
int result;
@CMAKE_TESTDRIVER_BEFORE_TESTMAIN@
+ if (testToRun < 0 || testToRun >= NumTests)
+ {
+ printf(
+ "testToRun was modified by TestDriver code to an invalid value: %3d.\n",
+ testNum);
+ return -1;
+ }
result = (*cmakeGeneratedFunctionMapEntries[testToRun].func)(ac, av);
@CMAKE_TESTDRIVER_AFTER_TESTMAIN@
return result;