Size calculation in pub fn to_str_radix
Phaiax opened this issue · 1 comments
Phaiax commented
Here, num_base_digits is called with size()-1:
https://github.com/Aatch/ramp/blob/master/src/int.rs#L275
So if the Int has one limb, num_base_digits is called with n=0, that will cause return 1 independent of base.
https://github.com/Aatch/ramp/blob/master/src/ll/base.rs#L48
I just found another related problem, but that would better be part of another issue.
Aatch commented
Ah, good catch. Fortunately it's only used for pre-allocating the Vec
, so it doesn't cause any real issues. Not sure why it passes size - 1
there.