Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,815
    • Issues 3,815
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #19585
Closed
Open
Created Aug 09, 2019 by Muhammed Furkan USLU@mfurkanusluContributor

ccmake crashes if a cache entry has set but empty STRINGS property

ccmake doesn't handle this situation. It assumes option count is greater than zero therefore it doesn't check option count.

For reproducing please follow this steps:

  1. create a new folder
  2. create a CMakeLists.txt file in the folder with this content:
cmake_minimum_required(VERSION 3.14.5)

project(prj CXX)

set(THE_VAR CACHE STRING "")
set_property(CACHE THE_VAR PROPERTY STRINGS "")
  1. run ccmake .
  2. configure project by pressing 'c' on ccmake.
  3. go to THE_VAR
  4. press Enter
  5. it gives segfault due to trying to access first element of vector which is empty.

I did this for last release (ccmake v3.15.2), and for master branch (which is at 70c56b85 now.) and results are same.

The backtrace:

#0  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign (this=0x6e8ee0, 
    __str=<error reading variable: Cannot access memory at address 0x28>)
    at /usr/src/debug/gcc-9.1.1-1.fc30.x86_64/obj-x86_64-redhat-linux/x86_64-redhat-linux/libstdc++-v3/include/bits/basic_string.tcc:259
#1  0x00000000005dc16a in cmCursesWidget::SetValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#2  0x00000000005e1888 in cmCursesOptionsWidget::HandleInput(int&, cmCursesMainForm*, _win_st*) ()
#3  0x00000000005e4485 in cmCursesMainForm::HandleInput() ()
#4  0x0000000000416449 in main ()
Edited Aug 11, 2019 by Muhammed Furkan USLU
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking