Fix detection of certain illegal corner cases when parsing numbers.