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

Fix crash when division by zero/modulo by zero happen on vectors #95172

Merged

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Aug 5, 2024

func test_vector():
	var v1 := Vector2i(1, 1)
	var v2 := Vector2i(0, 0)
	print(v1 / v2)

# or

func test_vector2():
	var v1 := Vector2i(1, 1)
	var v2 := 0
	print(v1 / v2)

Will now correctly finish with error, instead of silent crash.

@Chaosus Chaosus requested a review from a team as a code owner August 5, 2024 19:37
@Chaosus Chaosus added this to the 4.3 milestone Aug 5, 2024
@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from ca43819 to 22694e1 Compare August 6, 2024 04:41
@akien-mga akien-mga modified the milestones: 4.3, 4.4 Aug 7, 2024
@akien-mga akien-mga added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Aug 7, 2024
@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch 6 times, most recently from 9d26276 to ce265d9 Compare August 8, 2024 09:23
@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from ce265d9 to dfff6d3 Compare November 20, 2024 08:52
@Chaosus Chaosus requested a review from a team as a code owner November 20, 2024 08:52
@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from dfff6d3 to 63dbf59 Compare November 20, 2024 09:08
@Chaosus Chaosus requested a review from dalexeev November 20, 2024 10:08
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic behind this makes sense to me, but I'm not well-versed in the GDScript codegen implementation.

@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from 63dbf59 to a0799ed Compare November 21, 2024 08:14
Copy link
Member

@dalexeev dalexeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long delay! Added some comments, mostly about tests.

@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from a0799ed to ff49ab7 Compare November 21, 2024 15:54
@Chaosus Chaosus requested a review from dalexeev November 21, 2024 15:55
@Chaosus Chaosus force-pushed the gdscript_fix_vector_division_by_zero_crash branch from ff49ab7 to 0524e29 Compare November 21, 2024 17:24
Copy link
Member

@dalexeev dalexeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Repiteo Repiteo merged commit d11c1a4 into godotengine:master Nov 22, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 22, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release crash topic:gdscript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vector*i divide by zero crash
5 participants