Skip to content

Utf8JsonReader docs should mention that some properties are non-validating #2898

@GrabYourPitchforks

Description

@GrabYourPitchforks

/cc @ahsonkhan @bartonjs to get their opinions on this wording.

The properties Utf8JsonReader.ValueSpan and Utf8JsonReader.ValueSequence do not always contain well-formed data. For example, if the binary input to the Utf8JsonReader type contains ill-formed UTF-8 strings, the APIs will not detect this error until the caller attempts to materialize the string via the Utf8JsonReader.GetString method. If the consumer does not query this method and instead relies solely on ValueSequence / ValueSpan, there's the possibility that ill-formed UTF-8 data could make its way into the application.

This behavior is by-design. However, since it has potential security and reliability implications, it should probably be called out in the Remarks section for the ValueSequence / ValueSpan properties. If there's other validation that the Get* APIs would normally perform that are skipped by these raw property getters, that should also be called out in the same section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions