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 04098fd commit 54e0bd9
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 @@ -210,6 +210,7 @@ Version 1.13.0-dev:
* Fix bug #22134: Campaign prefix not used in mp campaign saves
* Made the error messages sent to stderr when the core data dir is
incorrectly set more helpful.
* Fix bug #20126: Recursive preprocessor includes cause infinite loop

Version 1.11.11:
* Add-ons server:
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 54e0bd9

Please sign in to comment.