Infinite loop on jump tables in 64 bit addressing #850
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.
Jump tables with a NZMask of 0xFFFF000000000000 would cause the int4 stride value to overflow to 0 on shift left after 32 times. At that point a 0 stride is returned. In the range this then causes a modulo division by 0 which VS2019 caught immediately. However in the current code somehow the division by 0 is not thrown and instead it just causes an infinite querying loop of the same address.
It starts addressing #729 as MIPS can this NZMask detected quite frequently - still getting too many branches however when the jump table should be easily recovered.
It appears that 0xFFFF000000000000 being the stride is likely the cause of the too many jump targets bug as well. Perhaps this should be fixed to be 64 bit not by simply avoiding 0.