Fixed crash on NULL dereference.

This commit is contained in:
Branimir Karadžić
2018-09-03 13:56:11 -07:00
parent 387e37541d
commit 07d909b5f0
3 changed files with 8 additions and 2 deletions

View File

@@ -1110,7 +1110,7 @@ void fpp_domsg(struct Global *global,
; ;
tp = file ? file->filename : 0; tp = file ? file->filename : 0;
fpp_Error(global, "%s\"%s\", line %d: %s: ", fpp_Error(global, "%s\"%s\", line %d: %s: ",
MSG_PREFIX, tp, global->infile->fp?global->line:file->line, severity); MSG_PREFIX, tp, global->infile?(global->infile->fp?global->line:file->line):0, severity);
if(global->error) if(global->error)
global->error(global->userdata, ErrorMessage[error], arg); global->error(global->userdata, ErrorMessage[error], arg);
#if defined(UNIX) #if defined(UNIX)

View File

@@ -334,6 +334,7 @@ project "fcpp"
"NWORK=65536", "NWORK=65536",
"NBUFF=65536", "NBUFF=65536",
"OLD_PREPROCESSOR=0", "OLD_PREPROCESSOR=0",
"MSG_PREFIX=\"Preprocessor: \"",
} }
files { files {

View File

@@ -1149,9 +1149,14 @@ namespace bgfx
// To avoid commented code being recognized as used feature, // To avoid commented code being recognized as used feature,
// first preprocess pass is used to strip all comments before // first preprocess pass is used to strip all comments before
// substituting code. // substituting code.
preprocessor.run(data); bool ok = preprocessor.run(data);
delete [] data; delete [] data;
if (!ok)
{
return false;
}
size = (uint32_t)preprocessor.m_preprocessed.size(); size = (uint32_t)preprocessor.m_preprocessed.size();
data = new char[size+padding+1]; data = new char[size+padding+1];
bx::memCopy(data, preprocessor.m_preprocessed.c_str(), size); bx::memCopy(data, preprocessor.m_preprocessed.c_str(), size);