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

Remove ignored UTF8 setting in diagMode() #417

Merged
merged 1 commit into from
Jul 30, 2023

Conversation

fxamacker
Copy link
Owner

Closes #416

Unreleased functions Diagnose() and DiagnoseFirst() added in v2.5.0-beta3 were ignoring the setting of DecOptions.UTF8 = DecodeInvalidUTF8 (to allow decoding invalid UTF-8) in the underlying decoder.

This PR is a NOP which simply removes the ignored code (instead of making it work) because:

  • Diagnostic functions rejecting invalid UTF-8 matches the default behavior of CBOR decoder.

  • It currently doesn't make sense to display invalid UTF-8 text. Diagnostic Notation described by RFC 8949 and the Extended Diagnostic Notation in Appendix G of RFC 8610 don't specify how to represent invalid UTF-8.

Unreleased functions Diagnose() and DiagnoseFirst() added in v2.5.0-beta3
were ignoring the setting of DecOptions.UTF8 = DecodeInvalidUTF8 in
the underlying decoder.

Given this, removing the ignored code is enough to make the new
diagnostic functions match the default behavior of CBOR decoder
which is to reject invalid UTF-8 in CBOR text strings.

For now, it doesn't make sense to print invalid UTF-8 text
because the Diagnostic Notation described by RFC 8949 and the
Extended Diagnostic Notation in Appendix G of RFC 8610 don't specify
how to represent invalid UTF-8.
@fxamacker fxamacker added the improvement improvement that does not add new feature label Jul 30, 2023
@fxamacker
Copy link
Owner Author

@x448 can you take a look? This is probably the last coding change before tagging v2.5.0 and it doesn't require re-fuzzing the unaffected non-diagnostic codec functions.

Also need to update README before tagging v2.5.0.

diagnose.go Show resolved Hide resolved
@fxamacker fxamacker merged commit 969aa36 into master Jul 30, 2023
14 checks passed
@fxamacker fxamacker deleted the remove-ignored-UTF8-setting-in-diagMode branch December 28, 2023 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement improvement that does not add new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove ignored UTF8 setting in diagMode()
2 participants