mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(Silky.ArcOpener): check for duplicate entry offsets.
This commit is contained in:
parent
3763a054dd
commit
2fd4d2cf7d
@ -23,12 +23,8 @@
|
|||||||
// IN THE SOFTWARE.
|
// IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
|
||||||
using GameRes.Compression;
|
|
||||||
using GameRes.Utility;
|
|
||||||
|
|
||||||
namespace GameRes.Formats.Silky
|
namespace GameRes.Formats.Silky
|
||||||
{
|
{
|
||||||
@ -56,6 +52,7 @@ namespace GameRes.Formats.Silky
|
|||||||
uint index_size = (uint)(count * (name_length + 8));
|
uint index_size = (uint)(count * (name_length + 8));
|
||||||
if (index_size > file.View.Reserve (index_offset, index_size))
|
if (index_size > file.View.Reserve (index_offset, index_size))
|
||||||
return null;
|
return null;
|
||||||
|
var seen_offsets = new HashSet<uint>();
|
||||||
var dir = new List<Entry>();
|
var dir = new List<Entry>();
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
@ -68,6 +65,8 @@ namespace GameRes.Formats.Silky
|
|||||||
entry.Size = file.View.ReadUInt32 (index_offset+4);
|
entry.Size = file.View.ReadUInt32 (index_offset+4);
|
||||||
if (entry.Offset < index_size+4 || !entry.CheckPlacement (file.MaxOffset))
|
if (entry.Offset < index_size+4 || !entry.CheckPlacement (file.MaxOffset))
|
||||||
return null;
|
return null;
|
||||||
|
if (!seen_offsets.Add ((uint)entry.Offset))
|
||||||
|
return null;
|
||||||
dir.Add (entry);
|
dir.Add (entry);
|
||||||
index_offset += 8;
|
index_offset += 8;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user