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(decoder): should reset crc16 when file's crc is 0 #221

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

muktihari
Copy link
Owner

  • When d.fileHeader.CRC == 0x0000, it means the FIT file might be using legacy header (12 bytes) so there is no crc integrity for the file_header. However, the file_crc that will validate the integrity of the messages should be present. We should reset the d.crc16 before returning nil, otherwise the calculation of the messages' crc might mismatch since d.crc16 is still containing file_header's crc calculation. (We don't need reset d.crc16 on error)
  • Clean up decoder's code

@muktihari muktihari added the bug Something isn't working label Apr 25, 2024
@muktihari muktihari self-assigned this Apr 25, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (868984f) to head (d5e6eb8).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #221   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         3610      3607    -3     
=========================================
- Hits          3610      3607    -3     

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

@muktihari muktihari merged commit 456a9fd into master Apr 25, 2024
4 checks passed
@muktihari muktihari deleted the fix/decoder-reset-crc branch April 25, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants