From 155a2a61ee57eee7735d031c489c90255b39797b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 14 Dec 2020 14:30:27 -0600 Subject: WIXBUG:6299 - Fix OverflowException in ReadUInt32. --- .../WixToolsetTest.Core.Burn/BurnReaderFixture.cs | 44 ++++++++++++++++++++++ .../WixToolsetTest.Core.Burn.csproj | 28 ++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 src/test/WixToolsetTest.Core.Burn/BurnReaderFixture.cs create mode 100644 src/test/WixToolsetTest.Core.Burn/WixToolsetTest.Core.Burn.csproj (limited to 'src/test/WixToolsetTest.Core.Burn') 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 @@ +// 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. + +namespace WixToolsetTest.Core.Burn +{ + using System; + using WixToolset.Core.Burn.Bundles; + using Xunit; + + public class BurnReaderFixture + { + [Fact] + public void CanReadUInt16Max() + { + var bytes = new byte[] { 0xFF, 0xFF }; + var offset = 0u; + + var result = BurnCommon.ReadUInt16(bytes, offset); + + Assert.Equal(UInt16.MaxValue, result); + } + + [Fact] + public void CanReadUInt32Max() + { + var bytes = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }; + var offset = 0u; + + var result = BurnCommon.ReadUInt32(bytes, offset); + + Assert.Equal(UInt32.MaxValue, result); + } + + [Fact] + public void CanReadUInt64Max() + { + var bytes = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + var offset = 0u; + + var result = BurnCommon.ReadUInt64(bytes, offset); + + Assert.Equal(UInt64.MaxValue, result); + } + } +} 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 @@ + + + + + + netcoreapp2.1 + false + embedded + + + + NU1701 + + + + + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb