...
This malicious BigInteger
class is clearly mutable because of the setValue()
method. Furthermore, the modPow()
method is subject to precision loss. (See guidelines "NUM00-J. Detect or prevent integer overflow," "NUM11-J. Check floating-point inputs for exceptional values," "NUM15-J. Ensure conversions of numeric types to narrower types do not result in lost or misinterpreted data," and "NUM17-J. Beware of precision loss when converting primitive integers to floating-point" for more information.) Any code that receives an object of this class, and assumes that the object is immutable will have unexpected behavior. This is particularly important because the BigInteger.modPow()
method has several useful cryptographic applications.
...