Skip to content

v1.2.1

Latest

Choose a tag to compare

@github-actions github-actions released this 18 Oct 07:29

Fixed

  • A stream or reader too large for one buffer is a Limit error, whatever MaxInputBytes says. With no input limit, or a limit above 2 GiB, a stream or reader larger than an array can hold, or one that never ends, could fail with another exception:

    • YamlSerializer.Deserialize, DeserializeAll and the compat readers over a TextReader threw ArgumentOutOfRangeException when no limit was set;
    • OneYaml.Compat.SharpYaml over a Stream threw IOException ("Stream was too long") or ran out of memory.

    They now stop with the usual limit error: a YamlException with category Limit, or in the compat packages the exception type that package already uses for a limit. With no limit set, a reader other than a StringReader (whose text is already in memory) is now read in chunks, as it already was under a limit, instead of in one call.

  • OneYaml.Compat.YamlDotNet error marks after non-ASCII text count characters, not bytes. Start.Index of a syntax error in text read from a string or a reader was the UTF-8 byte offset, so it was too large once a multi-byte character came before the error. It now counts UTF-16 characters, as YamlDotNet does, and a character outside the Basic Multilingual Plane counts as two columns, as in YamlDotNet. A leading byte order mark is still not counted.

  • OneYaml.Compat.SharpYaml holds the whole text to MaxInputBytes, not only its first document. A string, span, reader or stream with several documents was cut at the second document before the limit was checked, so Deserialize<object>("a: 1\n---\nb: 2\n", ...) with MaxInputBytes = 13 returned the first document instead of the limit error. The size of a string, span or reader is the UTF-8 size of its text without a leading byte order mark, as the core counts a string. A stream is held to its encoded size without the mark, and is read only up to the limit plus one buffer.

  • OneYaml.Compat.SharpYaml error marks in a string that starts with a byte order mark are no longer shifted. The marks (line, column and index) counted the mark as a character, and counted its bytes in the wrong place, so the same text gave different positions as a string and as a stream or reader. A string that began with a mark, a directive and more than one document could also read a wrong value (a: 1 came back as a: null). The mark is now never a column, whatever the input.

  • OneYaml.Compat.YamlDotNet marks of nodes and errors after a leading byte order mark are no longer shifted. When the text came from a string, or from a reader that keeps the mark, Start and End of every node after the first, and of an error, were off by the mark. They now equal the marks of the same text without it.