Skip to content
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

PDU depth field can exceed Canonical JSON integer bounds #1085

Open
DMRobertson opened this issue May 25, 2022 · 1 comment
Open

PDU depth field can exceed Canonical JSON integer bounds #1085

DMRobertson opened this issue May 25, 2022 · 1 comment

Comments

@DMRobertson
Copy link
Contributor

DMRobertson commented May 25, 2022

Link to problem area:

Issue

Name Type Description
depth integer Required: The maximum depth of the prev_events, plus one. Must be less than the maximum value for an integer (2^63 - 1). If the room’s depth is already at the limit, the depth must be set to the limit.

This refers to the maximum value of an signed 64-bit integer.

But Canonical JSON specifies that

[n]umbers in the JSON must be integers in the range [-(2**53)+1, (2**53)-1]

presumably because this is the range of integers that fits into an IEEE 64-bit float without loss of precision.

These two limits are inconsistent in any room version which enforces Canonical JSON on PDUs.

Expected behaviour

Easy: lower the limit defined in the PDU spec to 2**53 -1. Depending on your level of paranoia, this may require a new room version.
Hard: remove the depth field altogether, c.f. matrix-org/matrix-spec-proposals#3802

@DMRobertson DMRobertson added the spec-bug Something which is in the spec, but is wrong label May 25, 2022
@turt2live
Copy link
Member

It would be interesting to see which limit is respected by Synapse following matrix-org/matrix-spec-proposals#2540

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

No branches or pull requests

3 participants