proost commented on code in PR #471:
URL: https://github.com/apache/datasketches-cpp/pull/471#discussion_r2685172257


##########
tdigest/include/tdigest_impl.hpp:
##########
@@ -465,12 +497,24 @@ tdigest<T, A> tdigest<T, A>::deserialize(const void* 
bytes, size_t size, const A
   ptr += copy_from_mem(ptr, min);
   T max;
   ptr += copy_from_mem(ptr, max);
+  check_not_nan(min, "min");
+  check_not_infinite(min, "min");
+  check_not_nan(max, "max");
+  check_not_infinite(max, "max");
   vector_centroid centroids(num_centroids, centroid(0, 0), allocator);
   if (num_centroids > 0) ptr += copy_from_mem(ptr, centroids.data(), 
num_centroids * sizeof(centroid));
   vector_t buffer(num_buffered, 0, allocator);
   if (num_buffered > 0) copy_from_mem(ptr, buffer.data(), num_buffered * 
sizeof(T));
   uint64_t weight = 0;
-  for (const auto& c: centroids) weight += c.get_weight();
+  for (const auto& c: centroids) {
+    check_not_nan(c.get_mean(), "centroid mean");
+    check_not_infinite(c.get_mean(), "centroid mean");
+    weight += c.get_weight();

Review Comment:
   Thank you. 
[bded7aa](https://github.com/apache/datasketches-cpp/pull/471/commits/bded7aa1eb09c13daa742ce901443388e1a8994a)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to