Skip to content

reject non-finite decimal64 values on unmarshal - #1098

Open
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:decimal64-finite-check
Open

reject non-finite decimal64 values on unmarshal#1098
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:decimal64-finite-check

Conversation

@nabhan06

Copy link
Copy Markdown

sanitizeJSON and stringToKeyType parse a decimal64 leaf/key from an untrusted JSON string with strconv.ParseFloat, which happily accepts NaN, Inf and Infinity, so Unmarshal stores a non-finite float64 for a leaf whose schema can never hold one. That value then cannot be round-tripped back out since encoding/json rejects NaN and Inf, and a stored NaN quietly breaks equality and diffing. Reject a non-finite result at both parse sites so the value is turned away where it enters rather than surfacing much later.

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