Skip to content

Commit 130f725

Browse files
authored
Merge pull request #1088 from Keboo/fixStackTraceSmashing
Fixing issue where exception stack trace was getting smashed.
2 parents 0df1edb + 08f116f commit 130f725

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Squirrel/BinaryPatchUtility.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static void Create(byte[] oldData, byte[] newData, Stream output)
6868
t.Start();
6969
t.Join();
7070

71-
if (ex != null) throw ex;
71+
if (ex != null) throw new Exception("Error creating binary patch", ex);
7272
}
7373

7474
static void CreateInternal(byte[] oldData, byte[] newData, Stream output)
@@ -229,21 +229,18 @@ 0 32 Header
229229
long controlEndPosition = output.Position;
230230
WriteInt64(controlEndPosition - startPosition - c_headerSize, header, 8);
231231

232-
// write compressed diff data
232+
233233
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
234234
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress))
235235
{
236+
// write compressed diff data
236237
bz2Stream.Write(db, 0, dblen);
237-
}
238238

239-
// compute size of compressed diff data
240-
long diffEndPosition = output.Position;
241-
WriteInt64(diffEndPosition - controlEndPosition, header, 16);
239+
// compute size of compressed diff data
240+
long diffEndPosition = output.Position;
241+
WriteInt64(diffEndPosition - controlEndPosition, header, 16);
242242

243-
// write compressed extra data
244-
using (WrappingStream wrappingStream = new WrappingStream(output, Ownership.None))
245-
using (var bz2Stream = new BZip2Stream(wrappingStream, CompressionMode.Compress))
246-
{
243+
// write compressed extra data
247244
bz2Stream.Write(eb, 0, eblen);
248245
}
249246

0 commit comments

Comments
 (0)