Skip to content

Decimal::from_str_radix still panics on a long radix-36 value after #807 #817

Description

@SichangHe

In a debug build, evaluating

Decimal::from_str_radix(
    "zzzzzzzzzzzzzzzzzzz.zzzzzzzzzzzzzzzzzzz",
    36,
)

panics with an unsigned subtraction underflow. It should instead return
Err(Error::ExceedsMaximumPossibleValue).

The input has 19 radix-36 digits before and after the decimal point.

The panic occurs after a rounding carry after an underflow here:

(coeff.len() as u32) - (digits_before_dot as u32)

#807 did not fix this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions