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

Add protection from calling typeStr with an invalid type #601

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

ehaas
Copy link
Collaborator

@ehaas ehaas commented Dec 14, 2023

This checks before calling typeStr with the places that I could generate a crash, and adds a check for non-debug modes so that they'll return an obvious error instead of illegal behavior.

@ehaas
Copy link
Collaborator Author

ehaas commented Dec 14, 2023

Closes #585

@ehaas
Copy link
Collaborator Author

ehaas commented Dec 14, 2023

There are no tests because you need lots of errors in the first place to generate these crashes and I don't think the messages themselves would be very useful. I tested manually by making a builtin with a return type of .invalid and doing various operations on the returned value.

@Vexu Vexu linked an issue Feb 7, 2024 that may be closed by this pull request
@Vexu
Copy link
Owner

Vexu commented Feb 7, 2024

Sorry to make you check all potential places where this could happen but seeing the change now I agree that it'd be better to just check the type in typeStr and return an error.

@Vexu Vexu merged commit b7417bb into Vexu:master Feb 13, 2024
3 checks passed
@ehaas ehaas deleted the type-fixes branch February 13, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential crash with non-integer array size
2 participants