You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2020/05/01 00:35:39 UTC
[incubator-datasketches-cpp] 01/01: deserialize overrun tests
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch overrun_tests
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git
commit 86dee95974d9f9392b54db93f17960a9474cb694
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Thu Apr 30 17:35:11 2020 -0700
deserialize overrun tests
---
theta/test/theta_sketch_test.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/theta/test/theta_sketch_test.cpp b/theta/test/theta_sketch_test.cpp
index c2da035..9b9afc7 100644
--- a/theta/test/theta_sketch_test.cpp
+++ b/theta/test/theta_sketch_test.cpp
@@ -419,4 +419,18 @@ TEST_CASE("theta sketch: serialize deserialize stream and bytes equivalency", "[
}
}
+TEST_CASE("theta sketch: deserialize update single item buffer overrun", "[theta_sketch]") {
+ update_theta_sketch update_sketch = update_theta_sketch::builder().build();
+ update_sketch.update(1);
+ theta_sketch::vector_bytes bytes = update_sketch.serialize();
+ REQUIRE_THROWS_AS(update_theta_sketch::deserialize(bytes.data(), bytes.size() - 1), std::out_of_range);
+}
+
+TEST_CASE("theta sketch: deserialize compact single item buffer overrun", "[theta_sketch]") {
+ update_theta_sketch update_sketch = update_theta_sketch::builder().build();
+ update_sketch.update(1);
+ theta_sketch::vector_bytes bytes = update_sketch.compact().serialize();
+ REQUIRE_THROWS_AS(compact_theta_sketch::deserialize(bytes.data(), bytes.size() - 1), std::out_of_range);
+}
+
} /* namespace datasketches */
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org