mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-28 08:35:06 -05:00
GB: Don't read ghost slots
Read count from list, instead of using the full capacity. Malformed lists (truncated via count) with ghost slots should have those ghost slots ignored.
This commit is contained in:
@@ -173,7 +173,8 @@ public static void Unpack(ReadOnlySpan<byte> input, Span<byte> output, int strin
|
||||
var ofsStr1 = ofsBody + (capacity * lengthBody);
|
||||
var ofsStr2 = ofsStr1 + (capacity * stringLength);
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
var count = Math.Min(capacity, input[0]);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var species = input[1 + i];
|
||||
var body = input.Slice(ofsBody, lengthBody);
|
||||
|
||||
@@ -177,7 +177,8 @@ public static void Unpack(ReadOnlySpan<byte> input, Span<byte> output, int strin
|
||||
var ofsStr1 = ofsBody + (capacity * lengthBody);
|
||||
var ofsStr2 = ofsStr1 + (capacity * stringLength);
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
var count = Math.Min(capacity, input[0]);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var species = input[1 + i];
|
||||
var body = input.Slice(ofsBody, lengthBody);
|
||||
|
||||
Reference in New Issue
Block a user