Skip to content

Commit

Permalink
Prevent infinitely recursive macros (bug #20126)
Browse files Browse the repository at this point in the history
We simply use the system already in place for file inclusions, and bump the
limit up to 100 to appease compulsive macro users.
  • Loading branch information
AI0867 committed Jun 23, 2014
1 parent acb02f5 commit 6529bbc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -73,6 +73,7 @@ Version 1.11.15+dev:
* Fix bug in Random Recruit Micro AI: the AI can now handle custom castle
terrain independent of its terrain code
* Fix bug in Return Guardian Micro AI when there is no path to the return hex
* Fix bug #20126: Recursive preprocessor includes cause infinite loop

Version 1.11.15:
* Graphics:
Expand Down
2 changes: 1 addition & 1 deletion src/serialization/preprocessor.cpp
Expand Up @@ -1053,7 +1053,7 @@ bool preprocessor_data::get_chunk()
pop_token();
put(v.str());
}
else if ((macro = target_.defines_->find(symbol)) != target_.defines_->end())
else if (target_.depth_ < 100 && (macro = target_.defines_->find(symbol)) != target_.defines_->end())
{
preproc_define const &val = macro->second;
size_t nb_arg = strings_.size() - token.stack_pos - 1;
Expand Down

0 comments on commit 6529bbc

Please sign in to comment.