hazzik / mpqtool-export

Automatically exported from code.google.com/p/mpqtool
0 stars 1 forks source link

BlockTableSize may be larger than indeed #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download the attachment
2. try open it with mpqtool

What is the expected output? What do you see instead?
   在 System.IO.__Error.EndOfFile()
   在 System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   在 System.IO.BinaryReader.ReadUInt32()
   在 MpqReader.MpqBlock..ctor(BinaryReader br, UInt32 HeaderOffset) 位置
E:\Dev\War3Share\Deerchao.War3Share.Components\Mpq\MpqStructs.cs:行号 125
   在 MpqReader.MpqArchive.Init() 位置
E:\Dev\War3Share\Deerchao.War3Share.Components\Mpq\MpqArchive.cs:行号 100
   在 MpqReader.MpqArchive..ctor(Stream SourceStream) 位置
E:\Dev\War3Share\Deerchao.War3Share.Components\Mpq\MpqArchive.cs:行号 62

What version of the product are you using? On what operating system?
  current version.

Please provide any additional information below.
 a quick and dirty fix is to change line 99 of MpqArchive.cs from
            for (int i = 0; i < mHeader.BlockTableSize; i++)
                mBlocks[i] = new MpqBlock(br2, (uint)mHeaderOffset);

to:

            for (int i = 0; i < mHeader.BlockTableSize &&
br2.BaseStream.Position!=br2.BaseStream.Length; i++)
                mBlocks[i] = new MpqBlock(br2, (uint)mHeaderOffset);

Original issue reported on code.google.com by deerc...@gmail.com on 13 Nov 2007 at 3:59

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by fool...@gmail.com on 16 Nov 2007 at 10:50

GoogleCodeExporter commented 9 years ago
Fixed in revision 13

Original comment by fool...@gmail.com on 21 Nov 2007 at 1:03