-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider validating limits of property values #260
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tl;dr: One could check whether property
min/max
values make sense, depending on the data type (andoffset/scale
) that has been defined for the property.Brought up via CesiumGS/3d-tiles#711:
The validator currently checks whether raw metadata values obey the limits for the component data type. For example, when a property has the type
UINT16
, then a value of 99999 will cause an error for not being in the valid [0,65k] range.Things become mode tricky for for
max
/min
values. The documentation there currently saysThere could be some validation for this. For example, for a
UINT8
value, a maximum ofmax=-1
does not make sense. The point that makes this less trivial is thatoffset
andscale
have to be taken into account. So for aUINT8
value withscale=-1
, a maximum ofmax=-1
does make sense. Even this could be validated. The pseudocode for this check could roughly be:(with some sign hassle for negative
scale
values that is omitted here)But even this will find its limits, specifically related to "large" values (obviously, but not exclusively for
UINT64
- c.f. #251 ).The specification does not make statements about the possible values for
offset
andscale
that go beyond the general, overarching knowledge that ~"values larger than 2^53 may reduce portability". But for the validation, the results of computations with these values become relevant. For example, there may be a propertyComputing the valid
rawMin
/rawMax
values based on this, and checking the validity of arawValue
involves many places where the limited precision could cause false validation errors. One way of addressing that might be using an arbitrary-precision decimal library. But even if the computations took place with arbitrary precision, one still would have to perform checks againstbigint
at the right place, to make sure that the validation is correct even for values with an integer component type.The text was updated successfully, but these errors were encountered: