(PdOpener.TryOpen): check that index lies within file bounds.

This commit is contained in:
morkt
2015-06-28 07:37:20 +04:00
parent 7f42177c48
commit 02e68fcda9

View File

@@ -48,7 +48,7 @@ namespace GameRes.Formats.KAAS
public override ArcFile TryOpen (ArcView file) public override ArcFile TryOpen (ArcView file)
{ {
int index_offset = file.View.ReadByte (0); int index_offset = file.View.ReadByte (0);
if (index_offset <= 2) if (index_offset <= 2 || index_offset >= file.MaxOffset)
return null; return null;
int key = file.View.ReadByte (1); int key = file.View.ReadByte (1);
int count = 0xfff & file.View.ReadUInt16 (index_offset); int count = 0xfff & file.View.ReadUInt16 (index_offset);