Description
float_to_decimal_common in src/libcore/fmt/float.rs does this:
let mut buf = [0; 1024];
let mut parts = [flt2dec::Part::Zero(0); 16];
and then passes buf and parts to flt2dec::to_exact_fixed_str or flt2dec::to_shortest_str
Looking at the docs for those functions at https://ticki.github.io/redocs/std/num/flt2dec/fn.to_exact_fixed_str.html and https://ticki.github.io/redocs/std/num/flt2dec/fn.to_shortest_str.html the "parts" array needs to have length at least 5, right? And the "buf" array needs to be at least 800+ for the to_exact_fixed_str case but only 17 (MAX_SIG_DIGITS) for the to_shortest_str case, afaict. Changing the to_shortest_str case to not use the huge buffer would probably help out https://users.rust-lang.org/t/excessive-stack-usage-for-formatting/8023 too.
Also, it's not clear to me that the "buf" scratch buffer needs to be zero-initialized. Does it?