Skip to content

Integer bounds and elements accept a trailing NUL #233

Closed

Description

@CaffeinatedCoder

Problem

Integer bounds and elements accept a trailing NUL, which PostgreSQL text cannot hold:

  • Int32Range.ParseValue("31\0") → 31
  • Int16Set.Parse("{\"31\0\"}") → {31}
  • JSON "[1\u0000,5)" as an Int32Range → [1,4]

IntegerLiteral's fast path calls T.TryParse(…, NumberStyles.Integer, …), which tolerates trailing NULs. The new slow path from #127 refuses 0x1F\0 and 1_0\0. The decimal, float, temporal and Guid families refuse a trailing NUL, and StringSet refuses NUL (#133). Found by the pre-tag analysis (#179), part B. Older than 10.0.0: it ships in 9.x.

It is a tightening and silent today, so under the release rule it belongs in this major.

Change

Refuse '\0' before the fast path, on every integer entry point.

Done when

31\0 and a NUL inside a set element are in the refused rows of IntegerLiteralGrammarTests (and the corpus, if it has an integer NUL family), failing with the check removed. The changelog lists it under "what can break you".

Activity

  1. added this to the 10.0.0 milestone on Oct 18, 2026
  2. added
    bug
    silent
    breaking
    area/literals
    package/core
    severity/low
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/literalsbreakingbugpackage/coreseverity/lowsilent

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions