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

Crash with setvar on out-of-bounds list index #2104

Open
jtb20 opened this issue Oct 23, 2024 · 2 comments
Open

Crash with setvar on out-of-bounds list index #2104

jtb20 opened this issue Oct 23, 2024 · 2 comments

Comments

@jtb20
Copy link

jtb20 commented Oct 23, 2024

With a version of ysh grabbed from the CI:

julbrown@r15:~$ ysh --version
Oils 0.23.0             https://www.oilshell.org/

git commit = a732611bb0a6daedfff80a694c4830bdf531ae71                                   

I see this:

ysh julbrown@r15:~$ var Q=[]
ysh julbrown@r15:~$ setvar Q[2] = 3
Segmentation fault (core dumped)

FYI! (I expected either an error or automatic list extension -- not sure what should be inserted for the empty values for the latter though.)

andychu pushed a commit that referenced this issue Oct 23, 2024
This is issue #2104, reported by Julian Brown.

This makes mycpp List<T> consistent:

- at() already raised IndexError (some code cleanups)
- set() now raises IndexError
  - don't use set() for internal ops like NewList() and List::extend()
@andychu
Copy link
Contributor

andychu commented Oct 23, 2024

Fixed this, thank you for the report!

Latest commit should be very good - https://op.oilshell.org/uuu/github-jobs/8115/

@jtb20
Copy link
Author

jtb20 commented Oct 24, 2024

Thank you!

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

No branches or pull requests

2 participants