IL2CPP: Fix edge case where max metadata dest index can be greater than usagesCount (#110)
This commit is contained in:
@@ -151,7 +151,8 @@ namespace Il2CppInspector
|
|||||||
// Metadata usages (addresses)
|
// Metadata usages (addresses)
|
||||||
// Unfortunately the value supplied in MetadataRegistration.matadataUsagesCount seems to be incorrect,
|
// Unfortunately the value supplied in MetadataRegistration.matadataUsagesCount seems to be incorrect,
|
||||||
// so we have to calculate the correct number of usages above before reading the usage address list from the binary
|
// so we have to calculate the correct number of usages above before reading the usage address list from the binary
|
||||||
var addresses = Binary.Image.ReadMappedArray<ulong>(Binary.MetadataRegistration.metadataUsages, usages.Count);
|
var count = usages.Keys.Max() + 1;
|
||||||
|
var addresses = Binary.Image.ReadMappedArray<ulong>(Binary.MetadataRegistration.metadataUsages, (int) count);
|
||||||
foreach (var usage in usages)
|
foreach (var usage in usages)
|
||||||
usage.Value.SetAddress(addresses[usage.Key]);
|
usage.Value.SetAddress(addresses[usage.Key]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user