seebee-dev opened a new pull request, #49755:
URL: https://github.com/apache/arrow/pull/49755

   ### Rationale
   
   Fixes three bugs in `gdv_hash_using_openssl()` reported in #49752:
   
   1. **Unnecessary symbol export** — `gdv_hash_using_openssl()` is an internal 
helper called only by the public hash functions (`gdv_sha512_hash`, 
`gdv_sha256_hash`, `gdv_sha1_hash`, `gdv_md5_hash`). It should not be exported 
via `GANDIVA_EXPORT`.
   
   2. **Incorrect error condition** — The validity check after 
`EVP_DigestFinal_ex` used `&&`, requiring both `result_length != 
hash_digest_size` and `result_buf_size != (2 * hash_digest_size)` to be true 
before reporting an error. Either condition alone indicates a problem, so this 
should use `||`.
   
   3. **Wrong snprintf buffer size** — `snprintf` received the total buffer 
size instead of the remaining space (`result_buf_size - result_buff_index`), 
which could allow writing past the allocated region.
   
   ### What changes are included in this PR?
   
   - Removed `GANDIVA_EXPORT` from `gdv_hash_using_openssl` in both 
`hash_utils.h` and `hash_utils.cc`
   - Changed `&&` to `||` in the digest validation check
   - Corrected the `snprintf` size argument to use remaining buffer space
   
   ### Are these changes tested?
   
   Existing tests for `gdv_sha1_hash`, `gdv_sha256_hash`, `gdv_sha512_hash`, 
and `gdv_md5_hash` exercise `gdv_hash_using_openssl` through the public API. No 
test changes needed — the fixes correct error handling and symbol visibility 
without changing happy-path behavior.


-- 
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]

Reply via email to