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 janet_string_equalconst #1519

Merged

Conversation

ianthehenry
Copy link
Contributor

Check string length before pointer equality, so that a string is not considered equal to a prefix slice of itself.

I ran into this with a pretty gnarly bug where e.g. (symbol/slice 'abcdefg 0 3) returned 'abcdefg when the symcache was filled just so -- they hash differently, but if you get unlucky enough and there's a hash collision, the resolution runs janet_string_equalconst and erroneously says "oh yeah we found it" because cfun_symbol_slice just changes the len.

Check string length before pointer equality, so that a string is not considered
equal to a prefix slice of itself.
@bakpakin bakpakin merged commit bafa6bf into janet-lang:master Nov 17, 2024
13 checks passed
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.

2 participants