Summary
Capella’s WebUI can lead to database corruption when dealing with extremely large 64-bit Integers because the editing popover incorrectly rounds the value such that it becomes an overflow. Reference the included screenshot.
Steps to Reproduce
-
After setting up sync, I used the Swift SDK to save a
MutableDocument
containing a property with anInt
value of9,223,372,036,854,775,807
. That’s2^63 - 1
, which is the largest possible 64-bit Integer. -
I went to the Capella web UI, edited the document, and surprisingly saw this value in the editing UI:
9223372036854776000
. This is an overflow. It’s 193 larger than the largest possible 64-bit Integer because it has been rounded up and has dropped precision. -
The ACTUAL value stored in the database is still
2^63 - 1
and the "table of documents” behind the editing popover shows that correctly. It’s only the editing popover that has an incorrect, rounded value. -
Here’s the dangerous part: If I edit this number on the web interface, I can corrupt the value. Change the leading
9
to an8
and the database ends up storing this number:8,223,372,036,854,776,000
. That’s wrong. It SHOULD be storing8,223,372,036,854,775,807
. The incorrect value syncs down to my local device, propagating the erroneous rounding from the editing popover. -
Also dangerous: If I launch the editing interface on Capella’s web UI but I don’t actually change the number (say I edit a different property) and then click “save”, the numerical value stored in the database is still
2^63 - 1
. This means that, for large integers, what you see in the editing UI may not be the actual value that’s in the database when you save the document. You THINK you’re storing the number you see in that editing popover, but you’re actually storing a different one.
Jira
I looked through the projects in Jira, but did not find one for the Capella web interface. I figured I’d post the bug here so someone can put it in the right spot.