Skip to content

fix: reject non-finite floating-point default values#810

Open
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:fix/reject-nan-inf-default
Open

fix: reject non-finite floating-point default values#810
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:fix/reject-nan-inf-default

Conversation

@huan233usc

Copy link
Copy Markdown
Contributor

What

A float / double column default of NaN or ±Infinity passes SchemaField::Validate but cannot survive a metadata round-trip: the JSON serializer emits a non-finite number as null, which reads back as an absent default. The declared default is silently lost (and, because the key is present but null, the reader then errors on it).

How

ValidateDefault now rejects a non-finite floating default (std::isfinite on the float/double value) with a clear "value must be finite" error, so an unrepresentable default is caught up front rather than silently dropped on serialization.

Testing

SchemaFieldTest.ValidateRejectsNonFiniteFloatingDefault (NaN, +Inf, -Inf) and ValidateAcceptsFiniteFloatingDefault, verified fail-without / pass-with. Full schema_test passes (551 tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant