mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 21:55:34 +08:00
(ArcOpener): allow zero-length entries.
This commit is contained in:
parent
bccc8303ae
commit
85282b82d9
@ -125,8 +125,11 @@ namespace GameRes.Formats.Rpm
|
|||||||
entry.Size = LittleEndian.ToUInt32 (index, index_offset+4);
|
entry.Size = LittleEndian.ToUInt32 (index, index_offset+4);
|
||||||
entry.Offset = LittleEndian.ToUInt32 (index, index_offset+8);
|
entry.Offset = LittleEndian.ToUInt32 (index, index_offset+8);
|
||||||
entry.IsPacked = is_compressed != 0;
|
entry.IsPacked = is_compressed != 0;
|
||||||
|
if (0 != entry.Size)
|
||||||
|
{
|
||||||
if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset))
|
if (entry.Offset < data_offset || !entry.CheckPlacement (file.MaxOffset))
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
index_offset += 12;
|
index_offset += 12;
|
||||||
}
|
}
|
||||||
@ -135,6 +138,8 @@ namespace GameRes.Formats.Rpm
|
|||||||
|
|
||||||
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
public override Stream OpenEntry (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
|
if (0 == entry.Size)
|
||||||
|
return Stream.Null;
|
||||||
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
var input = arc.File.CreateStream (entry.Offset, entry.Size);
|
||||||
var packed = entry as PackedEntry;
|
var packed = entry as PackedEntry;
|
||||||
if (null == packed || !packed.IsPacked)
|
if (null == packed || !packed.IsPacked)
|
||||||
@ -144,7 +149,7 @@ namespace GameRes.Formats.Rpm
|
|||||||
|
|
||||||
EncryptionScheme GuessScheme (ArcView file, int count)
|
EncryptionScheme GuessScheme (ArcView file, int count)
|
||||||
{
|
{
|
||||||
int[] possible_sizes = { 32, 24 };
|
int[] possible_sizes = { 0x20, 0x18 };
|
||||||
byte[] first_entry = new byte[possible_sizes[0] + 12];
|
byte[] first_entry = new byte[possible_sizes[0] + 12];
|
||||||
if (first_entry.Length != file.View.Read (8, first_entry, 0, (uint)first_entry.Length))
|
if (first_entry.Length != file.View.Read (8, first_entry, 0, (uint)first_entry.Length))
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user