Reject non-finite CLI float inputs
This commit is contained in:
@@ -220,6 +220,11 @@ pp::foundation::Result<float> parse_float_arg(std::string_view text)
|
||||
pp::foundation::Status::invalid_argument("invalid floating-point value"));
|
||||
}
|
||||
|
||||
if (!std::isfinite(value)) {
|
||||
return pp::foundation::Result<float>::failure(
|
||||
pp::foundation::Status::invalid_argument("floating-point value must be finite"));
|
||||
}
|
||||
|
||||
return pp::foundation::Result<float>::success(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user