Repository navigation
Fixed
-
A stream or reader too large for one buffer is a
Limiterror, whateverMaxInputBytessays. 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,DeserializeAlland the compat readers over aTextReaderthrewArgumentOutOfRangeExceptionwhen no limit was set;OneYaml.Compat.SharpYamlover aStreamthrewIOException("Stream was too long") or ran out of memory.
They now stop with the usual limit error: a
YamlExceptionwith categoryLimit, or in the compat packages the exception type that package already uses for a limit. With no limit set, a reader other than aStringReader(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.YamlDotNeterror marks after non-ASCII text count characters, not bytes.Start.Indexof 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.SharpYamlholds the whole text toMaxInputBytes, 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, soDeserialize<object>("a: 1\n---\nb: 2\n", ...)withMaxInputBytes = 13returned 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.SharpYamlerror 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: 1came back asa: null). The mark is now never a column, whatever the input. -
OneYaml.Compat.YamlDotNetmarks 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,StartandEndof 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.