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 SEGV when give invalid object to variables. #1153

Merged
merged 1 commit into from
Nov 18, 2022
Merged

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Nov 17, 2022

I found another pattern to SEGV.

RBS::Parser.parse_type("bool", variables: 1)

This patch raises a TypeError and produces the following message

wrong argument type Integer (must be array or nil) (TypeError)

@soutaro
Copy link
Member

soutaro commented Nov 17, 2022

@ksss Thank you very much. 🙏 I'm curious what if we pass an array of something not symbol.

RBS::Parser.parse_type("bool", variables: [1])

I'm not sure if I implemented something to handle that case...

@soutaro
Copy link
Member

soutaro commented Nov 18, 2022

Confirmed no SEGV happens when we pass an array of object.

TypeError: wrong argument type Object (expected Symbol)

@soutaro soutaro added this to the RBS 2.8.0 milestone Nov 18, 2022
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

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

Thanks!

@soutaro soutaro merged commit 616b070 into ruby:master Nov 18, 2022
@ksss ksss deleted the segv2 branch November 18, 2022 01:25
@ksss
Copy link
Collaborator Author

ksss commented Nov 18, 2022

It seems that SYM2ID checks if the value is other than a symbol 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants