Skip to content

reject out-of-range decimal64 precision in sanitizeGNMI - #1099

Open
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:decimal64-precision-bound
Open

reject out-of-range decimal64 precision in sanitizeGNMI#1099
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:decimal64-precision-bound

Conversation

@nabhan06

Copy link
Copy Markdown

sanitizeGNMI decodes a gNMI Decimal64 by raising 10 to the power of Precision, a uint32 read straight from the untrusted value with no upper bound. A YANG decimal64 has at most 18 fraction digits, so a message that sets a decimal64 leaf with a large Precision makes big.Int.Exp build a multi-gigabyte integer (Precision=20,000,000 already costs 2.3s and 227MB, and the uint32 max is far worse). Reject any Precision above 18 before the exponentiation, matching the nil check already right above it.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 88.745% (+0.002%) from 88.743% — nabhan06:decimal64-precision-bound into openconfig:master

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.

2 participants