}
for (exponent = 0; next; next = io.NextInField(remaining, edit)) {
if (*next >= '0' && *next <= '9') {
- exponent = 10 * exponent + *next - '0';
+ if (exponent < 10000) {
+ exponent = 10 * exponent + *next - '0';
+ }
} else if (*next == ' ' || *next == '\t') {
if (bzMode) {
exponent = 10 * exponent;
const char *limit{str + maxConsume};
decimal::ConversionToBinaryResult<PRECISION> converted{
decimal::ConvertToBinary<PRECISION>(p, edit.modes.round, limit)};
- if (converted.flags & decimal::Invalid) {
+ if (converted.flags & (decimal::Invalid | decimal::Overflow)) {
return false;
}
if (edit.digits.value_or(0) != 0) {
io.HandleRelativePosition(p - str);
// Set FP exception flags
if (converted.flags != decimal::ConversionResultFlags::Exact) {
- if (converted.flags & decimal::ConversionResultFlags::Overflow) {
- return false; // let slow path deal with it
- }
RaiseFPExceptions(converted.flags);
}
return true;
std::optional<char32_t> PrepareInput(
const DataEdit &edit, std::optional<int> &remaining) {
remaining.reset();
- if (edit.descriptor == DataEdit::ListDirected) {
+ if (edit.IsListDirected()) {
std::size_t byteCount{0};
GetNextNonBlank(byteCount);
} else {