1
0
Fork 0
forked from fte/fteqw

Randomer found a way to crash fteqcc, but he still needs to fix his code.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2018 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-02-23 23:03:12 +00:00
parent 7518dec2f0
commit 3399f05c3b
3 changed files with 12 additions and 3 deletions

View file

@ -8518,6 +8518,7 @@ compiles the 0 terminated text, adding defintions to the pr structure
*/ */
pbool QCC_PR_CompileFile (char *string, char *filename) pbool QCC_PR_CompileFile (char *string, char *filename)
{ {
jmp_buf oldjb;
if (!pr.memory) if (!pr.memory)
QCC_Error (ERR_INTERNAL, "PR_CompileFile: Didn't clear"); QCC_Error (ERR_INTERNAL, "PR_CompileFile: Didn't clear");
@ -8545,21 +8546,29 @@ pbool QCC_PR_CompileFile (char *string, char *filename)
QCC_PR_Lex (); // read first token QCC_PR_Lex (); // read first token
memcpy(&oldjb, &pr_parse_abort, sizeof(oldjb));
while (pr_token_type != tt_eof) while (pr_token_type != tt_eof)
{ {
if (setjmp(pr_parse_abort)) if (setjmp(pr_parse_abort))
{ {
if (++pr_error_count > MAX_ERRORS) if (++pr_error_count > MAX_ERRORS)
{
memcpy(&pr_parse_abort, &oldjb, sizeof(oldjb));
return false; return false;
}
QCC_PR_SkipToSemicolon (); QCC_PR_SkipToSemicolon ();
if (pr_token_type == tt_eof) if (pr_token_type == tt_eof)
{
memcpy(&pr_parse_abort, &oldjb, sizeof(oldjb));
return false; return false;
} }
}
pr_scope = NULL; // outside all functions pr_scope = NULL; // outside all functions
QCC_PR_ParseDefs (NULL); QCC_PR_ParseDefs (NULL);
} }
memcpy(&pr_parse_abort, &oldjb, sizeof(oldjb));
return (pr_error_count == 0); return (pr_error_count == 0);
} }

View file

@ -572,7 +572,7 @@ pbool QCC_PR_Precompiler(void)
sm = '>'; sm = '>';
else else
{ {
QCC_PR_ParseError(0, "Not a string literal"); QCC_PR_ParseError(0, "Not a string literal (on a #include)");
sm = 0; sm = 0;
} }
pr_file_p++; pr_file_p++;

View file

@ -2806,7 +2806,7 @@ memset(pr_immediate_string, 0, sizeof(pr_immediate_string));
if (flag_caseinsensative) if (flag_caseinsensative)
{ {
printf("Compiling without case insensativity\n"); printf("Compiling without case sensativity\n");
pHash_Get = &Hash_GetInsensative; pHash_Get = &Hash_GetInsensative;
pHash_GetNext = &Hash_GetNextInsensative; pHash_GetNext = &Hash_GetNextInsensative;
pHash_Add = &Hash_AddInsensative; pHash_Add = &Hash_AddInsensative;