Skip to content

Commit

Permalink
Merge pull request #24 from barnson/bug4394
Browse files Browse the repository at this point in the history
WIXBUG:4394
  • Loading branch information
robmen committed May 3, 2014
2 parents 1723bd8 + 78cc0b6 commit 376043f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions History.md
@@ -1,3 +1,5 @@
* BobArnson: WIXBUG:4394 - Enforce a maximum include nesting depth of 1024 to avoid stack overflows when files include themselves.

* johnbuuck: WIXBUG:4279 - Add support for MSBuild version 12.0.

* mavxg: WIXFEAT:4373 - Add LogonAsBatchJob to WixUtilExtension.User
Expand Down
6 changes: 6 additions & 0 deletions src/tools/wix/Data/messages.xml
Expand Up @@ -2938,6 +2938,12 @@
<Parameter Type="System.String" Name="value" />
</Instance>
</Message>
<Message Id="TooDeeplyIncluded" Number="385">
<Instance>
Include files cannot be nested more deeply than {0} times. Make sure included files don't accidentally include themselves.
<Parameter Type="System.Int32" Name="depth" />
</Instance>
</Message>
</Class>

<Class Name="WixWarnings" ContainerName="WixWarningEventArgs" BaseContainerName="MessageEventArgs" Level="Warning">
Expand Down
5 changes: 5 additions & 0 deletions src/tools/wix/Preprocessor.cs
Expand Up @@ -1516,6 +1516,11 @@ private void WriteProcessingInstruction(XmlReader reader, XmlWriter writer, int
/// <param name="fileName">Name to push on to the stack of included files.</param>
private void PushInclude(string fileName)
{
if (1023 < this.currentFileStack.Count)
{
throw new WixException(WixErrors.TooDeeplyIncluded(this.GetCurrentSourceLineNumbers(), this.currentFileStack.Count));
}

this.currentFileStack.Push(fileName);
this.sourceStack.Push(this.currentLineNumber);
this.currentLineNumber = new SourceLineNumber(fileName);
Expand Down

0 comments on commit 376043f

Please sign in to comment.