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: Terminate decode record early if one of its fields failed to decode #384

Closed

Conversation

brianshih1
Copy link
Contributor

@brianshih1 brianshih1 commented Apr 23, 2024

I encountered another edge-casey bug that is causing a panic: runtime error: slice bounds out of range [4:1] when decoding a record. This is because the record decoder doesn't terminate early when there's an error with its field.

In the particular test cases provided, this line of code does not update r.tail, even though r.head is updated. Thus, we have a scenario where r.head > r.tail, which causes the slice bounds out of range error when decoding float.

Unfortunately, after trying for an hour I haven't been able to minimize the test to a smaller test.

@nrwiersma
Copy link
Member

This does not fix the underlying problem, that r.head > r.tail. This stems from an edge case bug in ReadInt and ReadLong.

@nrwiersma
Copy link
Member

I think #385 fixes the issue you are seeing.

@brianshih1
Copy link
Contributor Author

yup it fixes my example, thanks again!

@brianshih1 brianshih1 closed this Apr 23, 2024
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