Skip to content

SmileGenerator.writeNumber(String) validates number length against default StreamReadConstraints instead of configured ones #781

Description

@pjfanning

`SmileGenerator._writeIntegralNumber()` / `_writeDecimalNumber()` (used by `writeNumber(String)`) guard against too-long number Strings via `_streamReadConstraints().validateIntegerLength()` / `validateFPLength()`.

But `_streamReadConstraints()` returns `StreamReadConstraints.defaults()`, so a `maxNumberLength` configured on the `SmileFactory` is ignored on the write path — both a lower limit (not enforced) and a higher limit (spuriously rejected).

Since `IOContext` carries the factory's `StreamReadConstraints` (2.15+), the generator can use `_ioContext.streamReadConstraints()` instead.

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions