[cmake-developers] [CMake 0013114]: CPack segfaults if too many people belong to a certain group
Mantis Bug Tracker
mantis at public.kitware.com
Mon Apr 9 13:23:33 EDT 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13114
======================================================================
Reported By: Cesar
Assigned To:
======================================================================
Project: CMake
Issue ID: 13114
Category: CPack
Reproducibility: always
Severity: block
Priority: urgent
Status: new
======================================================================
Date Submitted: 2012-04-09 13:23 EDT
Last Modified: 2012-04-09 13:23 EDT
======================================================================
Summary: CPack segfaults if too many people belong to a
certain group
Description:
CPack, when trying to generate a TGZ package, segfaults in lookup_gname_helper
when there are too many people in the GID it is trying to identify. My builds
started failing immediately after that number was reached when IT added a new
member to the staff group. The realloc in case of ERANGE segfaults. If I
increase the buffer size to something larger by hand and recompile it works.
CPack is not the first to run into this issue:
https://issues.apache.org/bugzilla/show_bug.cgi?id=41105
Steps to Reproduce:
Run CPack to generate TGZs as a user belonging to a group containing "too many
people".
Also, the file in "addidional information" reproduces the problem every time for
our 5000 gid. If I increase the initial bufsize to 1024 it works. It is a
Solaris only problem, as our other platforms (Linux, Windows, Mac) work fine.
Additional Information:
#define _POSIX_PTHREAD_SEMANTICS
#include <grp.h>
#include <iostream>
int main(void)
{
struct group grent, *result;
result = &grent;
int bufsize=512;
char* buffer=(char*)malloc(bufsize);
for(;;)
{
int status = getgrgid_r(5000,
&grent,buffer,bufsize,&result);
if(!status)
{
std::cerr << "Buffer: " << buffer << std::endl;
break;
}
else if(status==34)
{
std::cerr << "Small buffer\n";
bufsize*=2;
buffer=(char*)realloc(buffer,bufsize);
}
}
return 0;
}
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-04-09 13:23 Cesar New Issue
======================================================================
More information about the cmake-developers
mailing list