Skip to content

Commit

Permalink
Script processing fails on files smaller than 8 bytes ... #145
Browse files Browse the repository at this point in the history
  • Loading branch information
xanathar committed Oct 3, 2016
1 parent c022326 commit 3107de6
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ sealed partial class Processor

internal static bool IsDumpStream(Stream stream)
{
using (BinaryReader br = new BinaryReader(stream, Encoding.UTF8))
if (stream.Length >= 8)
{
ulong magic = br.ReadUInt64();
stream.Seek(-8, SeekOrigin.Current);
return magic == DUMP_CHUNK_MAGIC;
using (BinaryReader br = new BinaryReader(stream, Encoding.UTF8))
{
ulong magic = br.ReadUInt64();
stream.Seek(-8, SeekOrigin.Current);
return magic == DUMP_CHUNK_MAGIC;
}
}
return false;
}

internal int Dump(Stream stream, int baseAddress, bool hasUpvalues)
Expand Down

0 comments on commit 3107de6

Please sign in to comment.