View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015367CMakeCMakepublic2015-01-22 23:042015-07-08 08:57
ReporterThomas Klausner 
Assigned ToBrad King 
PriorityhighSeveritycrashReproducibilitysometimes
StatusclosedResolutionfixed 
Platformamd64OSNetBSDOS Version7.99.4
Product VersionCMake 3.1 
Target VersionCMake 3.1.2Fixed in VersionCMake 3.1.2 
Summary0015367: cmake crash in GetNumberOfFilesInDirectory
DescriptionIn Source/kwsys/Directory.cxx, the result value of opendir() is not checked, which can lead to readdir being called with a NULL pointer as first argument, which, at least on NetBSD, leads to a segfault.
Steps To ReproduceI don't know how to cause this, but it happened to me in parallel builds on a tmpfs e.g. when building wesnoth.
Additional InformationThe attached patch returns '0' as count for directories when opendir fails, which makes wesnoth build for me. Perhaps dirp==NULL should be reported, but I don't know how to best do that, so I'll leave that up to you.
TagsNo tags attached.
Attached Filescxx file icon patch-Source_kwsys_Directory.cxx [^] (491 bytes) 2015-01-22 23:04

 Relationships

  Notes
(0037788)
Brad King (manager)
2015-01-23 13:17

Thanks. I've applied a fix in KWSys upstream and submitted for testing here:

 http://review.source.kitware.com/18941 [^]

Once merged there it can be integrated into CMake too.
(0037811)
Brad King (manager)
2015-01-26 10:27

This has now been integrated in upstream KWSys and ported to CMake:

 KWSys Directory: Check opendir return value before using it
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=482c8475 [^]
(0037923)
Brad King (manager)
2015-02-05 09:24

I merged this fix into the 'release' branch for 3.1.2.
(0039040)
Robert Maynard (manager)
2015-07-08 08:57

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

 Issue History
Date Modified Username Field Change
2015-01-22 23:04 Thomas Klausner New Issue
2015-01-22 23:04 Thomas Klausner File Added: patch-Source_kwsys_Directory.cxx
2015-01-23 13:17 Brad King Note Added: 0037788
2015-01-26 10:27 Brad King Note Added: 0037811
2015-01-26 10:27 Brad King Assigned To => Brad King
2015-01-26 10:27 Brad King Status new => resolved
2015-01-26 10:27 Brad King Resolution open => fixed
2015-01-26 10:27 Brad King Fixed in Version => CMake 3.2
2015-01-26 10:27 Brad King Target Version => CMake 3.2
2015-02-05 09:24 Brad King Note Added: 0037923
2015-02-05 09:24 Brad King Fixed in Version CMake 3.2 => CMake 3.1.2
2015-02-05 09:24 Brad King Target Version CMake 3.2 => CMake 3.1.2
2015-07-08 08:57 Robert Maynard Note Added: 0039040
2015-07-08 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team