Skip to content

Commit

Permalink
Fix uninitialized values when parsing zeroes
Browse files Browse the repository at this point in the history
`0.e0` will not initialize the significant reference argument.
`00[..]0.[0...]` will not initialize exponent nor significant.
  • Loading branch information
Flamefire committed Dec 27, 2024
1 parent 43f4a45 commit dc05f5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/boost/charconv/detail/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ inline from_chars_result parser(const char* first, const char* last, bool& sign,

if (next == last)
{
significand = 0;
exponent = 0;
return {last, std::errc()};
}
}
Expand Down Expand Up @@ -366,6 +368,8 @@ inline from_chars_result parser(const char* first, const char* last, bool& sign,
significand += 1;
}
}
else
significand = 0;
}
else
{
Expand Down

0 comments on commit dc05f5d

Please sign in to comment.