num-bigint icon indicating copy to clipboard operation
num-bigint copied to clipboard

Possible Incompleteness

Open YichiZhang0613 opened this issue 11 months ago • 2 comments

In num-bigint/src/bigint.rs and num-bigint/src/biguint.rs, I think the code should check modulus != 0 and exponent >= 0/modulus != 0 as comments mentioned before use them to avoid possible panic. num-bigint/src/bigint.rs

/// Panics if the exponent is negative or the modulus is zero.
    pub fn modpow(&self, exponent: &Self, modulus: &Self) -> Self {
        power::modpow(self, exponent, modulus)
    }

num-bigint/src/biguint.rs

/// Panics if the modulus is zero.
    pub fn modpow(&self, exponent: &Self, modulus: &Self) -> Self {
        power::modpow(self, exponent, modulus)
    }

YichiZhang0613 avatar Mar 02 '24 12:03 YichiZhang0613