Repository navigation
Description
Problem
#233 (PR #242) refused a NUL in integer text, but two siblings still read 31\0 as 31. PostgreSQL text can't hold U+0000 (('31'||chr(0))::int → "null character not permitted"). Found by the final pre-release analysis on add665c.
-
The decimal family.
DecimalLiteralcallsdecimal.ParsewithNumberStyles.Float, which ignores trailing NULs, and so doesBigInteger.ParseinRepresents.DecimalRange.Parse("[31\0,40)")→[31,40), andDecimalRange.Finite.TryParsegives the same.RangeSet<DecimalRange,decimal>.ParseandDecimalSet.Parse("{31\0}")→{31}, andDecimalSet<Money>likewise.- The TypeConverter, and JSON
"[31\u0000,40)". DecimalSetandDecimalSet<T>JSON["31\u0000"]underAllowReadingFromString(ValueSetElementJson.ReadDecimalText), where System.Text.Json's own decimal converter throws."1.5\0"is refused, but only because the precision check counts the NUL as a fraction digit, so the message is wrong.
PR fix: refuse a NUL in integer bounds and elements #242's description says the decimal family already refused NUL; it didn't.
-
The integer wrapper arities' JSON.
Int16Set<T>,Int32Set<T>andInt64Set<T>read["31\u0000"]as{31}underAllowReadingFromString, whileInt32Setandint[]throwJsonException.ValueSetElementJsonConverter.cs:60(ReadIntegerText) runslong.TryParse(text, AllowLeadingSign, …), which accepts the NUL, then re-formats the number, soIntegerLiteral's check never sees it. This contradicts the 10.0.0 changelog line ("the wrapper sets, in a literal and JSON") and migration.md's "Send a wrapper set the JSON you send the plain set".
Silent; the first case is older than 10.0.0, so it is a tightening that belongs in this major.
Change
Refuse U+0000 at the top of DecimalLiteral.Parse and before the integer wrapper's long.TryParse (or hand the raw text to ParseValue). Sweep every numeric family's element and bound readers for the same BCL leniency.
Done when
31\0 and 1e2\0 are refused through ParseValue, the literal, and JSON under AllowReadingFromString, for DecimalRange, DecimalSet, DecimalSet<T> and the three integer wrapper arities. Each fails with its check removed. The changelog's NUL line names the decimal family too.
Activity