Skip to content

[AArch64 / Win64 / Bug Fix] Bug fix for jump tables on aarch64-win64 (fixes #40198)

Summary

This merge request fixes an issue with jump tables (used in case blocks) where their use would trigger access violations.

(Fix was made pursuant to a bug bounty sponsored by InstallAware Software)

System

  • Operating system: Microsoft Windows 10
  • Processor architecture: AArch64
  • Device: Raspberry Pi 4

What is the current bug behavior?

If a jump table is generated (-O1 and above and if the case block has more than 10 branches), trying to enter said case block would result in an access violation.

What is the behavior after applying this patch?

Jump tables should now work properly.

Additional notes

The problem appeared to be two-fold. Firstly, trying to read data from a code block seemed to trigger an access violation, although it wasn't clear if this was a permissions issue or a fault with the pointer. The other issue is the risk of relative offsets not working properly. As such, for aarch64-win64 exclusively, the full 64-bit addresses are used instead. As a result of the last point, it may require refactoring later.

Edited by J. Gareth "Kit" Moreton

Merge request reports