Skip to content

Commit

Permalink
Fix crash when loading image from VPX files
Browse files Browse the repository at this point in the history
  • Loading branch information
vbousquet committed Nov 11, 2023
1 parent b4ff9f7 commit e9307fd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions FlexDMD/VPXFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private byte[] ReadImage(CFStream stream, bool nameOnly)
while (!done)
{
var bytesInRecordRemaining = reader.ReadUInt32();
var fieldStart = reader.GetPos();
var tag = reader.ReadString(Encoding.ASCII, 4);
switch (tag)
{
Expand Down Expand Up @@ -143,6 +144,7 @@ private byte[] ReadImage(CFStream stream, bool nameOnly)
}
break;
}
reader.Seek(fieldStart + bytesInRecordRemaining);
}
return data;
}
Expand All @@ -166,6 +168,16 @@ public void Skip(int count)
_pos += count;
}

public long GetPos()
{
return _pos;
}

public void Seek(long newPos)
{
_pos = newPos;
}

public int ReadInt32()
{
_stream.Read(_buffer, _pos, 4);
Expand Down

0 comments on commit e9307fd

Please sign in to comment.