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

runtime/expr: fix malformed empty record from record spread #4359

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

nwt
Copy link
Member

@nwt nwt commented Feb 2, 2023

A record spread expression that produces an empty record (e.g., "{...a}" evaluated with "this" bound to a Zed primitive value) results in a zed.Value with malformed bytes, which can cause a panic elsewhere. Fix this in recordSpreadExpr.Eval by returning a well-formed zed.Value.

For better or worse, we don't have any existing tests for malformed zed.Values, so I'm not adding one here.

Closes #4349.

A record spread expression that produces an empty record (e.g., "{...a}"
evaluated with "this" bound to a Zed primitive value) results in a
zed.Value with malformed bytes, which can cause a panic elsewhere.  Fix
this in recordSpreadExpr.Eval by returning a well-formed zed.Value.

For better or worse, we don't have any existing tests for malformed
zed.Values, so I'm not adding one here.

Closes #4349.
@nwt nwt requested a review from a team February 2, 2023 22:15
@nwt nwt merged commit a2f68a3 into main Feb 2, 2023
@nwt nwt deleted the fix-record-spread branch February 2, 2023 23:36
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.

"panic: runtime error: index out of range" from spread attempt on error value
2 participants