mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:22:57 +00:00
-fix an endless loop when a rbuild file has an invalid date
See issue #2466 for more details. svn path=/trunk/; revision=27810
This commit is contained in:
parent
df43dc0653
commit
a7b34c7f12
3 changed files with 38 additions and 0 deletions
|
@ -522,6 +522,9 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
|
||||||
ProjectNode.GetProjectFilename ().c_str () );
|
ProjectNode.GetProjectFilename ().c_str () );
|
||||||
string xmlbuildFilenames;
|
string xmlbuildFilenames;
|
||||||
int numberOfExistingFiles = 0;
|
int numberOfExistingFiles = 0;
|
||||||
|
struct stat statbuf;
|
||||||
|
time_t SystemTime, lastWriteTime;
|
||||||
|
|
||||||
for ( size_t i = 0; i < ProjectNode.xmlbuildfiles.size (); i++ )
|
for ( size_t i = 0; i < ProjectNode.xmlbuildfiles.size (); i++ )
|
||||||
{
|
{
|
||||||
XMLInclude& xmlbuildfile = *ProjectNode.xmlbuildfiles[i];
|
XMLInclude& xmlbuildfile = *ProjectNode.xmlbuildfiles[i];
|
||||||
|
@ -530,6 +533,28 @@ MingwBackend::GenerateXmlBuildFilesMacro() const
|
||||||
numberOfExistingFiles++;
|
numberOfExistingFiles++;
|
||||||
if ( xmlbuildFilenames.length () > 0 )
|
if ( xmlbuildFilenames.length () > 0 )
|
||||||
xmlbuildFilenames += " ";
|
xmlbuildFilenames += " ";
|
||||||
|
|
||||||
|
FILE* f = fopen ( xmlbuildfile.topIncludeFilename.c_str (), "rb" );
|
||||||
|
if ( !f )
|
||||||
|
throw FileNotFoundException ( NormalizeFilename ( xmlbuildfile.topIncludeFilename ) );
|
||||||
|
|
||||||
|
if ( fstat ( fileno ( f ), &statbuf ) != 0 )
|
||||||
|
{
|
||||||
|
fclose ( f );
|
||||||
|
throw AccessDeniedException ( NormalizeFilename ( xmlbuildfile.topIncludeFilename ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
lastWriteTime = statbuf.st_mtime;
|
||||||
|
SystemTime = time(NULL);
|
||||||
|
|
||||||
|
if (SystemTime != -1)
|
||||||
|
{
|
||||||
|
if (difftime (lastWriteTime, SystemTime) > 0)
|
||||||
|
throw InvalidDateException ( NormalizeFilename ( xmlbuildfile.topIncludeFilename ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose ( f );
|
||||||
|
|
||||||
xmlbuildFilenames += NormalizeFilename ( xmlbuildfile.topIncludeFilename );
|
xmlbuildFilenames += NormalizeFilename ( xmlbuildfile.topIncludeFilename );
|
||||||
if ( numberOfExistingFiles % 5 == 4 || i == ProjectNode.xmlbuildfiles.size () - 1 )
|
if ( numberOfExistingFiles % 5 == 4 || i == ProjectNode.xmlbuildfiles.size () - 1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,13 @@ InvalidOperationException::InvalidOperationException (
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvalidDateException::InvalidDateException ( const string& filename)
|
||||||
|
: Exception ( "File '%s' has an invalid date.",
|
||||||
|
filename.c_str() )
|
||||||
|
{
|
||||||
|
Filename = filename;
|
||||||
|
}
|
||||||
|
|
||||||
InvalidOperationException::InvalidOperationException (
|
InvalidOperationException::InvalidOperationException (
|
||||||
const char* filename,
|
const char* filename,
|
||||||
const int linenumber,
|
const int linenumber,
|
||||||
|
|
|
@ -73,6 +73,12 @@ public:
|
||||||
std::string Filename;
|
std::string Filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class InvalidDateException : public Exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InvalidDateException ( const std::string& filename );
|
||||||
|
std::string Filename;
|
||||||
|
};
|
||||||
|
|
||||||
class RequiredAttributeNotFoundException : public XMLInvalidBuildFileException
|
class RequiredAttributeNotFoundException : public XMLInvalidBuildFileException
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue