diff --git a/canonical-binary.md b/canonical-binary.md index b592e3e..7d9b0fd 100644 --- a/canonical-binary.md +++ b/canonical-binary.md @@ -26,6 +26,8 @@ Annotations MUST NOT be present. Placeholders MUST NOT be used. Where possible, fixed-length ("format A") MUST be used in preference to variable-length ("format B") formats. +Lengths in variable-length encodings (base 128 varints) MUST be as +short as possible. **Signed integers.** When a `SignedInteger` *n* is greater than or equal to -3 and less diff --git a/preserves.md b/preserves.md index cc63a01..82b1684 100644 --- a/preserves.md +++ b/preserves.md @@ -516,6 +516,10 @@ The following table illustrates varint-encoding. | 300 | `0000010 0101100` | 172 2 | | 1000000000 | `0000011 1011100 1101011 0010100 0000000` | 128 148 235 220 3 | +It is an error for a varint-encoded `m` in a `Repr` to be anything +other than the unique shortest encoding for that `m`. That is, a +varint-encoding of `m` *MUST NOT* end in `0` unless `m`=0. + #### Streaming data of unknown length (format C). A `Repr` where the length of the `Value` to be encoded is variable and