View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013138CMakeCMakepublic2012-04-16 16:242013-01-09 10:55
ReporterAndras Lasso 
Assigned ToBrad King 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformWindows7 64-bitOSOS Version
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.9Fixed in VersionCMake 2.8.9 
Summary0013138: CMake crashes in cmListCommand::HandleInsertCommand
DescriptionCMake crashes when trying to build a Slicer 4.1 extension. The problem is reproducible with CMake-2.8.8-rc2.

The CMake build scripts are quite complex, so there might be some error in the scripts, but anyway CMake reject the execution of the invalid command and print a meaningful error message instead of crashing.

The same build completes without problems on several computers, CMake crashes only on one computer.
Steps To ReproduceInvokeInitialPass (in cmcommand.h) is called with the following arguments:
args[0]="INSERT"
args[1]="Slicer_LAUNCH_COMMAND"
args[2]="${launch_index}"
args[3]="--launcher-additional-settings"
args[4]="${Slicer_ADDITIONAL_LAUNCHER_SETTINGS}"

after this->Makefile->ExpandArguments(args, expandedArguments)

expandedArguments[0]="INSERT"
expandedArguments[1]="Slicer_LAUNCH_COMMAND"
expandedArguments[2]="-1"
expandedArguments[3]="--launcher-additional-settings"
expandedArguments[4]="E:/src/cmake-2.8.7-vs2005/Source/AdditionalLauncherSettings.ini"

Note that expandedArguments[2]="-1" => this doesn't seem to be correct.

After this cmListCommand::HandleInsertCommand is called, and in that

int item = atoi(args[2].c_str());

=> item = -1

CMake then crashes in the same function at this line:

varArgsExpanded.insert(varArgsExpanded.begin()+item+cnt, args[cc]);

If I change item to 0 then there is no crash.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0029192)
Brad King (manager)
2012-04-16 16:59

I can reproduce the crash with the code

set(mylist "")
list(INSERT mylist -1 x)


The implementation of list(INSERT) was added here:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f87271d0 [^]
  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed1ea24c [^]

It does not check for the case that a list is defined but empty and a python-style negative index is used.
(0029202)
Brad King (manager)
2012-04-17 11:11

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=05604eb9 [^]
(0032021)
Robert Maynard (manager)
2013-01-09 10:55

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-04-16 16:24 Andras Lasso New Issue
2012-04-16 16:59 Brad King Note Added: 0029192
2012-04-17 11:11 Brad King Note Added: 0029202
2012-04-17 11:11 Brad King Status new => resolved
2012-04-17 11:11 Brad King Resolution open => fixed
2012-04-17 11:11 Brad King Assigned To => Brad King
2012-08-09 16:59 David Cole Fixed in Version => CMake 2.8.9
2012-08-09 16:59 David Cole Target Version => CMake 2.8.9
2013-01-09 10:55 Robert Maynard Note Added: 0032021
2013-01-09 10:55 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team