diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-12-14 14:30:27 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-12-14 14:54:27 -0600 |
| commit | 155a2a61ee57eee7735d031c489c90255b39797b (patch) | |
| tree | 55e7d2530d9430ccda7837bbbf4be6c23dbfbb4f /src/test | |
| parent | f970f584c1caac8927ee9d9090fe19f5a2a8b50d (diff) | |
| download | wix-155a2a61ee57eee7735d031c489c90255b39797b.tar.gz wix-155a2a61ee57eee7735d031c489c90255b39797b.tar.bz2 wix-155a2a61ee57eee7735d031c489c90255b39797b.zip | |
WIXBUG:6299 - Fix OverflowException in ReadUInt32.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/WixToolsetTest.Core.Burn/BurnReaderFixture.cs | 44 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Core.Burn/WixToolsetTest.Core.Burn.csproj | 28 |
2 files changed, 72 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.Core.Burn/BurnReaderFixture.cs b/src/test/WixToolsetTest.Core.Burn/BurnReaderFixture.cs new file mode 100644 index 00000000..a83da7f6 --- /dev/null +++ b/src/test/WixToolsetTest.Core.Burn/BurnReaderFixture.cs | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Core.Burn | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using WixToolset.Core.Burn.Bundles; | ||
| 7 | using Xunit; | ||
| 8 | |||
| 9 | public class BurnReaderFixture | ||
| 10 | { | ||
| 11 | [Fact] | ||
| 12 | public void CanReadUInt16Max() | ||
| 13 | { | ||
| 14 | var bytes = new byte[] { 0xFF, 0xFF }; | ||
| 15 | var offset = 0u; | ||
| 16 | |||
| 17 | var result = BurnCommon.ReadUInt16(bytes, offset); | ||
| 18 | |||
| 19 | Assert.Equal(UInt16.MaxValue, result); | ||
| 20 | } | ||
| 21 | |||
| 22 | [Fact] | ||
| 23 | public void CanReadUInt32Max() | ||
| 24 | { | ||
| 25 | var bytes = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }; | ||
| 26 | var offset = 0u; | ||
| 27 | |||
| 28 | var result = BurnCommon.ReadUInt32(bytes, offset); | ||
| 29 | |||
| 30 | Assert.Equal(UInt32.MaxValue, result); | ||
| 31 | } | ||
| 32 | |||
| 33 | [Fact] | ||
| 34 | public void CanReadUInt64Max() | ||
| 35 | { | ||
| 36 | var bytes = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | ||
| 37 | var offset = 0u; | ||
| 38 | |||
| 39 | var result = BurnCommon.ReadUInt64(bytes, offset); | ||
| 40 | |||
| 41 | Assert.Equal(UInt64.MaxValue, result); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
diff --git a/src/test/WixToolsetTest.Core.Burn/WixToolsetTest.Core.Burn.csproj b/src/test/WixToolsetTest.Core.Burn/WixToolsetTest.Core.Burn.csproj new file mode 100644 index 00000000..da0985b1 --- /dev/null +++ b/src/test/WixToolsetTest.Core.Burn/WixToolsetTest.Core.Burn.csproj | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 3 | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>netcoreapp2.1</TargetFramework> | ||
| 7 | <IsPackable>false</IsPackable> | ||
| 8 | <DebugType>embedded</DebugType> | ||
| 9 | </PropertyGroup> | ||
| 10 | |||
| 11 | <PropertyGroup> | ||
| 12 | <NoWarn>NU1701</NoWarn> | ||
| 13 | </PropertyGroup> | ||
| 14 | |||
| 15 | <ItemGroup> | ||
| 16 | <ProjectReference Include="..\..\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" /> | ||
| 17 | </ItemGroup> | ||
| 18 | |||
| 19 | <ItemGroup> | ||
| 20 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
| 21 | </ItemGroup> | ||
| 22 | |||
| 23 | <ItemGroup> | ||
| 24 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> | ||
| 25 | <PackageReference Include="xunit" Version="2.4.1" /> | ||
| 26 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | ||
| 27 | </ItemGroup> | ||
| 28 | </Project> | ||
