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

Disable str($# + 1) #1619

Merged
merged 1 commit into from
Nov 14, 2020
Merged

Disable str($# + 1) #1619

merged 1 commit into from
Nov 14, 2020

Conversation

mmisono
Copy link
Collaborator

@mmisono mmisono commented Nov 14, 2020

Although str($#) is already disabled in the semantic analyzer, it's done
in the final pass. So, str($#+1) tries to do Binop analysis and
std::out_of_range error occurs. I think the check does not need to be
done in the final pass, so simply check this in all passes.

This fixes the following errors:

% sudo ./src/bpftrace -e 'BEGIN { printf("%s", str($# + 1)); exit();}' aaa
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 1)
zsh: abort      sudo ASAN_OPTIONS=detect_leaks=0 ./src/bpftrace -e  aaa
Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

Although `str($#)` is already disabled in the semantic analyzer, it's done
in the final pass. So, `str($#+1)` tries to do Binop analysis and
std::out_of_range error occurs. I think the check does not need to be
done in the final pass, so simply check this in all passes.

This fixes the following errors:

```
% sudo ./src/bpftrace -e 'BEGIN { printf("%s", str($# + 1)); exit();}' aaa
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 1)
zsh: abort      sudo ASAN_OPTIONS=detect_leaks=0 ./src/bpftrace -e  aaa
```
@fbs fbs merged commit c07b4db into bpftrace:master Nov 14, 2020
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