From f1319ba0080fcc358127a108e521b1e0d743e503 Mon Sep 17 00:00:00 2001 From: Dave Tuchlinsky Date: Fri, 3 Aug 2018 17:20:52 -0400 Subject: [PATCH 1/2] Fix #5859 (Melt crashes melting MSIs with elevated privileges) --- src/tools/wix/Pdb.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/tools/wix/Pdb.cs b/src/tools/wix/Pdb.cs index ee3bba3cf..f574496a1 100644 --- a/src/tools/wix/Pdb.cs +++ b/src/tools/wix/Pdb.cs @@ -84,6 +84,7 @@ public static Pdb Load(string path, bool suppressVersionCheck, bool suppressSche internal static Pdb Load(Stream stream, Uri uri, bool suppressVersionCheck, bool suppressSchema) { XmlReader reader = null; + TempFileCollection tempFileCollection = null; string cabPath = null; // look for the Microsoft cabinet file header and save the cabinet data if found @@ -91,10 +92,8 @@ internal static Pdb Load(Stream stream, Uri uri, bool suppressVersionCheck, bool { long cabFileSize = 0; byte[] offsetBuffer = new byte[4]; - using (TempFileCollection tempFileCollection = new TempFileCollection()) - { - cabPath = tempFileCollection.AddExtension("cab", true); - } + tempFileCollection = new TempFileCollection()) + cabPath = tempFileCollection.AddExtension("cab", false); // skip the header checksum stream.Seek(4, SeekOrigin.Current); @@ -138,16 +137,7 @@ internal static Pdb Load(Stream stream, Uri uri, bool suppressVersionCheck, bool } Pdb pdb = Parse(reader, suppressVersionCheck); - - if (null != cabPath) - { - if (pdb.Output.TempFiles == null) - { - pdb.Output.TempFiles = new TempFileCollection(); - } - - pdb.Output.TempFiles.AddFile(cabPath, false); - } + pdb.Output.TempFiles = tempFileCollection; return pdb; } From ada7537adb8568c5858b5b5a9a5a20cb2f5b03a3 Mon Sep 17 00:00:00 2001 From: Dave Tuchlinsky Date: Tue, 7 Aug 2018 12:50:49 -0400 Subject: [PATCH 2/2] Fixed syntax error that slipped in before commiting. --- src/tools/wix/Pdb.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/wix/Pdb.cs b/src/tools/wix/Pdb.cs index f574496a1..92da3aee3 100644 --- a/src/tools/wix/Pdb.cs +++ b/src/tools/wix/Pdb.cs @@ -92,7 +92,7 @@ internal static Pdb Load(Stream stream, Uri uri, bool suppressVersionCheck, bool { long cabFileSize = 0; byte[] offsetBuffer = new byte[4]; - tempFileCollection = new TempFileCollection()) + tempFileCollection = new TempFileCollection(); cabPath = tempFileCollection.AddExtension("cab", false); // skip the header checksum