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

Port fix: Fix JSPB binary utf8 decoding and validate by default (breaking change) #191

Merged
merged 2 commits into from
Jul 16, 2024

Commits on Jul 16, 2024

  1. Port fix: Fix JSPB binary utf8 decoding to be spec compliant.

    Our prior behavior was extremely undefined when confronted with errors, it would read out of bounds, accept overlong encodings, skip over out of range bytes, compose out of range codepoints. The new implementation always detects and handles errors consistently by either throwing or using replacement characters (� aka \uFFFD)
    
    This also adds support for aligning with the proto3 spec to the code generator which requires that parsing fail for proto3 messages with invalid utf8 payloads for string fields. For now, actual failing is disabled via the goog.define jspb.binary.ENFORCE_UTF8 which is set to NEVER. A future change will flip this to DEFAULT.
    dibenede committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    993b707 View commit details
    Browse the repository at this point in the history
  2. clarify enforceUtf8 argument

    Co-authored-by: Luke Sandberg <lukesandberg@users.noreply.github.com>
    dibenede and lukesandberg committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    f7fee3d View commit details
    Browse the repository at this point in the history