lriggs commented on code in PR #49780:
URL: https://github.com/apache/arrow/pull/49780#discussion_r3102100236
##########
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:
The test actually does cause a problem on Windows when linking against the
ssl function for some reason. It works on other OSs. Im going to just remove it
since it wasn't a highly valuable test, it only tested the input check.
--
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]