Reject non-finite PPI layer opacity
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <bit>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -338,6 +339,11 @@ pp::foundation::Result<PpiBodySummary> parse_ppi_body_impl(
|
||||
seen_orders[order.value()] = true;
|
||||
}
|
||||
|
||||
if (!std::isfinite(opacity.value())) {
|
||||
return pp::foundation::Result<PpiBodySummary>::failure(
|
||||
pp::foundation::Status::invalid_argument("PPI layer opacity must be finite"));
|
||||
}
|
||||
|
||||
if (opacity.value() < 0.0F || opacity.value() > 1.0F) {
|
||||
return pp::foundation::Result<PpiBodySummary>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI layer opacity is outside the supported range"));
|
||||
@@ -677,6 +683,11 @@ pp::foundation::Result<std::vector<std::byte>> create_ppi_project(PpiProjectConf
|
||||
pp::foundation::Status::out_of_range("PPI layer name exceeds the configured limit"));
|
||||
}
|
||||
|
||||
if (!std::isfinite(layer.metadata.opacity)) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::invalid_argument("PPI layer opacity must be finite"));
|
||||
}
|
||||
|
||||
if (layer.metadata.opacity < 0.0F || layer.metadata.opacity > 1.0F) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI layer opacity is outside the supported range"));
|
||||
|
||||
Reference in New Issue
Block a user