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: proto value unmarshal strings as utf8 string #247

Merged
merged 1 commit into from
May 10, 2024

Conversation

muktihari
Copy link
Owner

@muktihari muktihari commented May 10, 2024

Previously, we decode string as it is, even if string in FIT protocol should be a valid utf8 string, there is no guarantee that we got a valid utf8 string when the FIT file is not properly encoded. Now, we will ensure that every character in the string is a valid utf8 character, any invalid character will be replaced with utf8.RuneError ('\uFFFD'/).

Additional changes:

  • Improve UnmarshalValue loop on slice value, this change will reduce bound check.

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

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ac559cb) to head (618723d).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #247   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           42        42           
  Lines         3615      3628   +13     
=========================================
+ Hits          3615      3628   +13     

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

@muktihari muktihari merged commit 9cdaa3a into master May 10, 2024
4 checks passed
@muktihari muktihari deleted the fix/proto-value-unmarshal-string-as-utf8-string branch May 10, 2024 11:43
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.

2 participants