Internal change
PiperOrigin-RevId: 489302200
diff --git a/dpf/distributed_point_function.cc b/dpf/distributed_point_function.cc
index 9cd18bd..e94bec8 100644
--- a/dpf/distributed_point_function.cc
+++ b/dpf/distributed_point_function.cc
@@ -283,6 +283,9 @@
// Copy seeds and control bits. We will swap these after every expansion.
DpfExpansion expansion;
expansion.seeds = hwy::AllocateAligned<absl::uint128>(output_size);
+ if (expansion.seeds == nullptr) {
+ return absl::ResourceExhaustedError("Out of memory");
+ }
std::copy_n(partial_evaluations.seeds.get(), current_level_size,
expansion.seeds.get());
expansion.control_bits = partial_evaluations.control_bits;
diff --git a/dpf/internal/proto_validator.cc b/dpf/internal/proto_validator.cc
index f2d4b18..44f2565 100644
--- a/dpf/internal/proto_validator.cc
+++ b/dpf/internal/proto_validator.cc
@@ -156,6 +156,9 @@
return absl::InvalidArgumentError(
"`log_domain_size` must be non-negative");
}
+ if (log_domain_size > 128) {
+ return absl::InvalidArgumentError("`log_domain_size` must be <= 128");
+ }
if (i > 0 && log_domain_size <= previous_log_domain_size) {
return absl::InvalidArgumentError(
"`log_domain_size` fields must be in ascending order in "
@@ -204,6 +207,7 @@
// last_level_output_correction.
continue;
}
+ DCHECK(hierarchy_to_tree_[i] < key.correction_words_size());
if (key.correction_words(hierarchy_to_tree_[i])
.value_correction()
.empty()) {