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

chore: clean up encoder #67

Merged
merged 1 commit into from
Dec 26, 2023
Merged

chore: clean up encoder #67

merged 1 commit into from
Dec 26, 2023

Conversation

muktihari
Copy link
Owner

@muktihari muktihari commented Dec 26, 2023

  • This is not a bug but a potential bug (can cause panic index out of bound) if it's being abused when declaring unsupported header.Size, for example this crc calculation might cause panic e.crc16.Write(b[:header.Size-2]) if the result of subtraction is negative, now we check the size early on and have fixed len e.crc16.Write(b[:12]) since we now the exact len. Now we used explicit slice indexes for crc, was b[header.Size-2:] now b[12:14]. If user passing header.Size < 12 it will be replaced by default one (header with size = 14). We only guard against something that might cause panic, if user still passing wrong size intentionally, so be it, it will not cause panic or error, only the fit file might not be read by other decoder.
  • Fix typo on lru's Put method's docs.

@muktihari muktihari added the chore update not related to the functionality of the sdk, e.g. update workflow label Dec 26, 2023
@muktihari muktihari self-assigned this Dec 26, 2023
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cca8f0b) 100.00% compared to head (fdd9623) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #67   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2995      2993    -2     
=========================================
- Hits          2995      2993    -2     

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

@muktihari muktihari merged commit 9f5fdbb into master Dec 26, 2023
1 check passed
@muktihari muktihari deleted the chore/encoder-clean-up-code branch December 26, 2023 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore update not related to the functionality of the sdk, e.g. update workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants