Repository navigation
fix: refuse a NUL in decimal text and in the integer wrapper sets' JSON - #270
Merged
Merged
Conversation
#233 refused a NUL in integer text, but two siblings still read "31\0" as 31 (#251). DecimalLiteral went through decimal.Parse with NumberStyles.Float (and BigInteger.Parse in Represents), which ignore trailing NULs, so DecimalRange, its multirange, DecimalSet and DecimalSet<T> read it in every entry point; "1.5\0" was refused only because the precision check counted the NUL as a digit. And ReadIntegerText, the quoted-number path of the integer wrapper sets' JSON, ran long.TryParse and re-formatted the number, so Int16Set<T>, Int32Set<T> and Int64Set<T> read ["31\u0000"] under AllowReadingFromString where the plain sets throw. Both now refuse U+0000. Swept: the float families validate their own grammar and refuse it; the decimal JSON path hands the raw text to DecimalLiteral; a wrapper element formatting with a NUL is refused when the set is built. NumericNulTests: the decimal family through ParseValue, literals, the Finite shape and JSON; the integer families' JSON, plain and wrapper; the float families held as they are. With the decimal check removed 3 rows fail, with the integer JSON check removed 2. The changelog's NUL line and the migration guide name the decimal family. parser-reads-the-current-culture.patch is refreshed against the new DecimalLiteral and still CAUGHT. Closes #251 Found-By: CA Defect-Class: LIT Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #251
Problem
#233 (PR #242) rejected a NUL in integer text, but two siblings still read
31\0as 31. PostgreSQL text can't hold U+0000.DecimalLiteraluseddecimal.ParsewithNumberStyles.Float, andBigInteger.ParseinRepresents. Both ignore trailing NULs. SoDecimalRange, its multirange,DecimalSetandDecimalSet<T>read31\0and1e2\0through every entry point.1.5\0was rejected only because the precision check counted the NUL as a digit. fix: refuse a NUL in integer bounds and elements #242's description said the decimal family already rejected a NUL. I had based that on1.5\0, and it was wrong.ReadIntegerText, the quoted-number path, ranlong.TryParseand then re-formatted the number. SoInt16Set<T>,Int32Set<T>andInt64Set<T>read["31\u0000"]underAllowReadingFromString, where the plain sets throw.Change
DecimalLiteral.Parserejects U+0000 first, with a message that names the rule.ValueSetElementJson.ReadIntegerTextrejects a NUL beforelong.TryParse.Swept the other numeric readers:
DecimalLiteral, so it needs no check of its own.I added a check only where removing it fails a test.
CHANGELOG 10.0.0 → Breaking: the NUL line now names
DecimalRangeandDecimalSet. The migration guide's NUL bullet and section say "integer or decimal".Tests
NumericNulTests:ParseValue(range, set, wrapper), the literals (range,DecimalRange.Finite, multirange, set, wrapper set) and JSON;31\0,1e2\0,31\0\0). With the integer JSON check removed, 2 rows fail.1.5\0passes either way, rejected by the precision check as before.parser-reads-the-current-culture.patchtouches the sameDecimalLiterallines. It is refreshed and still CAUGHT by both culture oracles (4 of 61).🤖 Generated with Claude Code