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(cbor): incorrect decoding with subarrays #6344

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

BlackAsLight
Copy link
Contributor

This pull request fixes a simple bug in the event a subarray is passed into decodeCbor which would cause data to be incorrectly decoded and/or throw an error.

@BlackAsLight BlackAsLight requested a review from kt3k as a code owner January 12, 2025 01:26
@github-actions github-actions bot added the cbor label Jan 12, 2025
Copy link

codecov bot commented Jan 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.40%. Comparing base (55b1c7e) to head (2129d89).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6344      +/-   ##
==========================================
- Coverage   96.40%   96.40%   -0.01%     
==========================================
  Files         549      549              
  Lines       41841    41841              
  Branches     6350     6350              
==========================================
- Hits        40337    40336       -1     
- Misses       1464     1465       +1     
  Partials       40       40              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kt3k
Copy link
Member

kt3k commented Jan 14, 2025

The fix looks good, but how about passing byteOffset and byteLength to DataView constructor instead?

@BlackAsLight
Copy link
Contributor Author

That is probably better. I didn't even realise that was an option.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@kt3k kt3k merged commit c73f668 into denoland:main Jan 15, 2025
18 checks passed
@BlackAsLight BlackAsLight deleted the cbor_buffer_offset branch January 15, 2025 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants