fix DeltaSerializer validation checks and add one more
This commit is contained in:
parent
6f7f94a06e
commit
86b33bd3ce
|
@ -126,7 +126,7 @@ namespace BizHawk.Common
|
||||||
{
|
{
|
||||||
header = -header;
|
header = -header;
|
||||||
|
|
||||||
if (header < dataEnd - dataPos || header < deltaEnd - deltaPos)
|
if (dataEnd - dataPos < header || deltaEnd - deltaPos < header)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Corrupt delta header!");
|
throw new InvalidOperationException("Corrupt delta header!");
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ namespace BizHawk.Common
|
||||||
}
|
}
|
||||||
else // sameness block
|
else // sameness block
|
||||||
{
|
{
|
||||||
if (header < dataEnd - dataPos)
|
if (dataEnd - dataPos < header)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Corrupt delta header!");
|
throw new InvalidOperationException("Corrupt delta header!");
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,11 @@ namespace BizHawk.Common
|
||||||
|
|
||||||
dataPos += header;
|
dataPos += header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataPos != dataEnd)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Did not reach end of data after applying delta!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue