Skip Class::GetDefaultFieldValue when the xref is not a function entry - #280
Open
Joshtt23 wants to merge 2 commits into
Open
Skip Class::GetDefaultFieldValue when the xref is not a function entry#280Joshtt23 wants to merge 2 commits into
Joshtt23 wants to merge 2 commits into
Conversation
On some Unity 6 IL2CPP builds the jump-target walk lands on an unaligned epilogue (jmp into ret). Detouring that aborts the CLR. Keep the existing First/Last heuristic when that address is 16-byte aligned; otherwise pick another aligned target or skip this hook with a warning. Same rule as imageGetTypeXrefs. Do not refuse every unaligned hook globally. Signature hits are unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 20, 2026
nint has no ToInt64 on this TF; (ptr & 0xF) is the same 16-byte entry check. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FindClassGetFieldDefaultValueXreflands on an unaligned epilogue (ajmpinto the ret path), notClass::GetDefaultFieldValue.0x80131506).[^2]heuristic when that pointer is 16-byte aligned. Otherwise pick another aligned jump target, or skip this hook only with a warning (no throw).imageGetTypeXrefsinMetadataCache_GetTypeInfoFromTypeDefinitionIndex_Hook.Hook.ApplyHook.Test plan
Runtime-tested on Unity
6000.3.15x1/ metadata 39 (Rust client). Class::Init is a separate change (#277).