This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit 005648152bdd9304ff432fa4bc0718c0a41ba494 Author: chaokunyang <[email protected]> AuthorDate: Sun Aug 2 17:06:26 2026 +0000 🔄 synced local 'docs/specification/' with remote 'docs/specification/' --- docs/specification/java_serialization_spec.md | 16 ++++++++++++++++ docs/specification/xlang_serialization_spec.md | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/docs/specification/java_serialization_spec.md b/docs/specification/java_serialization_spec.md index 607fffe772..732cbfd351 100644 --- a/docs/specification/java_serialization_spec.md +++ b/docs/specification/java_serialization_spec.md @@ -502,6 +502,22 @@ known statically: Boxed primitives use the same value payload after the selected null/reference slot. +### Big-Number Value Range + +Java native `BigInteger` and `BigDecimal` serializers accept an absolute +integer or unscaled magnitude of at most `10_000` canonical unsigned binary +bytes. `BigDecimal` also accepts only scales in `[-10_000, 10_000]`. + +These are accepted-value limits, not changes to native or xlang encoding. A +leading sign byte in Java's signed two's-complement native body does not count +toward the magnitude limit. Writers reject an out-of-range value before writing +any part of it. Readers validate the logical magnitude before allocating the +body or constructing `BigInteger` or `BigDecimal`, and retain the existing +readable-byte, length, overflow, and canonical checks. + +Compatible scalar conversion keeps its separate `256`-digit and scale/output +expansion limits. + ## String Values Java strings are encoded as: diff --git a/docs/specification/xlang_serialization_spec.md b/docs/specification/xlang_serialization_spec.md index a015325d98..6ce845417c 100644 --- a/docs/specification/xlang_serialization_spec.md +++ b/docs/specification/xlang_serialization_spec.md @@ -1618,6 +1618,8 @@ The mathematical value is: - `scale` is encoded as signed varint32. - `scale` carries no extra flags or mode bits. +- Arbitrary-precision decimal carriers accept only + `-10_000 <= scale <= 10_000`. #### Unscaled Header @@ -1652,6 +1654,10 @@ Encoding: - `unscaledHeader = (meta << 1) | 1` - `payload = magnitude as canonical minimal little-endian bytes` +For arbitrary-precision decimal carriers, `len` must not exceed `10_000`. +This limit counts only the canonical unsigned binary bytes of `abs(unscaled)`; +it does not count the header, decimal digits, or textual representations. + Decoding: - `meta = unscaledHeader >>> 1` @@ -1673,6 +1679,17 @@ After decoding `scale` and `unscaled`, the decimal value is reconstructed as: `value = unscaled × 10^-scale` +The scale and magnitude bounds are accepted-value limits, not changes to the +wire encoding. Writers must reject values outside them, and readers must reject +them before allocating the magnitude or constructing the decimal while still +checking that an accepted body is readable and canonically encoded. A target +with a fixed-range decimal carrier may impose a stricter native range. + +The compatible scalar conversion limits described earlier in this specification +remain independent. In particular, conversion that formats plain text, +rescales, quantizes, or otherwise expands output must retain its own expected +output-length checks; the ordinary decimal scale bound does not replace them. + ### struct Struct means object of `class/pojo/struct/bean/record` type. Struct values are serialized by writing --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
