Detours icon indicating copy to clipboard operation
Detours copied to clipboard

Fix detour_does_code_end_function for ARM64

Open m417z opened this issue 8 months ago • 0 comments

It incorrectly returned FALSE for br <reg> instructions.

The bug caused Detours to override follow-up instructions after a function end, instead of failing, for example:

00007ffc`29e4b910 c9e6dab0 adrp    x9, 00007FFBDFB24000
00007ffc`29e4b914 20011fd6 br      x9
00007ffc`29e4b918 ; Unrelated instruction or data

The previous check ((Opcode & 0xfffffc1f) == 0xd65f0000) only matched ret <reg> instructions, despite the incorrect comment.

ARM64 instruction references:

m417z avatar Apr 26 '25 21:04 m417z