Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/tools/wix/Binder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6274,14 +6274,21 @@ private void UpdateFileRow(Output output, IDictionary<string, string> infoCache,
string version;
string language;

using (FileStream fileStream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))
try
{
if (Int32.MaxValue < fileStream.Length)
using (FileStream fileStream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))
{
throw new WixException(WixErrors.FileTooLarge(fileRow.SourceLineNumbers, fileRow.Source));
}
if (Int32.MaxValue < fileStream.Length)
{
throw new WixException(WixErrors.FileTooLarge(fileRow.SourceLineNumbers, fileRow.Source));
}

fileRow.FileSize = Convert.ToInt32(fileStream.Length, CultureInfo.InvariantCulture);
fileRow.FileSize = Convert.ToInt32(fileStream.Length, CultureInfo.InvariantCulture);
}
}
catch (IOException e)
{
throw new WixException(WixErrors.BinderIOException(fileRow.SourceLineNumbers, fileInfo.FullName, e.Message));
}

try
Expand Down
7 changes: 7 additions & 0 deletions src/tools/wix/Data/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4012,5 +4012,12 @@
<Parameter Type="System.Int64" Name="size" />
</Instance>
</Message>
<Message Id="BinderIOException" Number="9035">
<Instance>
The file '{0}' cannot be accessed. Exception: {1}
<Parameter Type="System.String" Name="fileName" />
<Parameter Type="System.String" Name="exceptionMessage" />
</Instance>
</Message>
</Class>
</Messages>