dmitry-chirkov-dremio commented on code in PR #49780:
URL: https://github.com/apache/arrow/pull/49780#discussion_r3097018146
##########
cpp/src/gandiva/hash_utils_test.cc:
##########
@@ -316,3 +317,22 @@ TEST(TestShaHashUtils, TestMD5Varlen) {
EXPECT_EQ(md5_2_as_str.size(), md5_size);
EXPECT_EQ(md5_2_as_str, expected_second_result);
}
+
+// Verify that gdv_hash_using_openssl() reports an error when result_buf_size
does not
+// equal 2 * hash_digest_size (tests the || fix from GH-49752).
+TEST(TestShaHashUtils, TestHashUsingOpenSSLInvalidBufSize) {
+ gandiva::ExecutionContext ctx;
+ auto ctx_ptr = reinterpret_cast<int64_t>(&ctx);
+
+ std::string msg = "hello";
+ int32_t out_length = -1;
+
+ // SHA-256 digest is 32 bytes, so result_buf_size must be 64. Pass 63 to
trigger
+ // the error path that was previously guarded by && instead of ||.
+ const char* result = gandiva::gdv_hash_using_openssl(
Review Comment:
We now accessing `gdv_hash_using_openssl()` in a roundabout way.
I'd be fine in this case to proceed without the test.
There's a way to make `gdv_hash_using_openssl()` "internal" for the sake of
this test bug is it worth it?
--
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]