Skip to content
Snippets Groups Projects
Commit 424c584d authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Abort parser after 20 lines with errors (instead of trying to parse
everything, even huge binary files :-)
parent fa08fad4
No related branches found
No related tags found
No related merge requests found
// $Id: OpenFile.cpp,v 1.51 2004-03-30 18:17:11 geuzaine Exp $
// $Id: OpenFile.cpp,v 1.52 2004-04-13 18:49:25 geuzaine Exp $
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
......@@ -110,8 +110,16 @@ int ParseFile(char *f, int silent, int close)
fgets(tmp, sizeof(tmp), yyin);
fsetpos(yyin, &position);
while(!feof(yyin))
int errorcount = 0;
while(!feof(yyin)){
yyparse();
if(yyerrorstate)
errorcount++;
if(errorcount > 20){
Msg(GERROR, "Too many errors: aborting...");
break;
}
}
if(THEM)
status = THEM->status;
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment