Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UB when using Gravity #6036

Open
cawtds opened this issue Jan 16, 2025 · 0 comments
Open

UB when using Gravity #6036

cawtds opened this issue Jan 16, 2025 · 0 comments
Labels
bug Bug category: battle-mechanic Pertains to battle mechanics status: unconfirmed This bug has not been reproduced yet

Comments

@cawtds
Copy link

cawtds commented Jan 16, 2025

Description

Using gravity leads to UB due to jumpifnexttargetvalid iterating over gBattlerTarget. gBattlerTarget ends up being 4 and accesses gLastHitBy in Cmd_moveend (case MOVEEND_UPDATE_LAST_MOVES) out of bounds. (https://github.com/rh-hideout/pokeemerald-expansion/blob/75d5edad08fba9c2ae478c78ced865cbf4e90fa4/src/battle_script_commands.c/#L6459)
Other moves using jumpifnexttargetvalid are potentially affected as well.

Version

upcoming (Edge)

Upcoming/master Version

75d5eda

Discord contact info

.cawt

@cawtds cawtds added bug Bug category: battle-mechanic Pertains to battle mechanics status: unconfirmed This bug has not been reproduced yet labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug category: battle-mechanic Pertains to battle mechanics status: unconfirmed This bug has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant