additonal checks to reduce false positives.

This commit is contained in:
morkt 2016-07-10 12:18:38 +04:00
parent 9133adeab9
commit ebb6c91a73
2 changed files with 11 additions and 2 deletions

View File

@ -69,7 +69,9 @@ namespace GameRes.Formats.Eushully
int palette_size = reader.ReadInt32();
uint width = reader.ReadUInt16();
uint height = reader.ReadUInt16();
if (0 == palette_size || 0 == width || 0 == height || palette_size >= stream.Length)
if (palette_size <= 0 || 0 == width || 0 == height || palette_size >= stream.Length)
return null;
if (bpp <= 8 && palette_size > 0x100)
return null;
return new GpMetaData
{

View File

@ -90,7 +90,13 @@ namespace GameRes.Formats.Selen
++count;
if (count > 0x7f)
return null;
m_input.Seek (b > 0x7f ? 1 : count, SeekOrigin.Current);
if (b > 0x7f)
{
if (-1 == m_input.ReadByte())
return null;
}
else
m_input.Seek (count, SeekOrigin.Current);
key_lines.Clear();
key_lines.AddRange (scan_lines.Keys);
@ -118,6 +124,7 @@ namespace GameRes.Formats.Selen
var valid_lines = from line in scan_lines where line.Key == line.Value
orderby line.Key
select line.Key;
bool is_eof = -1 == m_input.ReadByte();
foreach (var width in valid_lines)
{
int height = Math.DivRem (total, width, out rem);