You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/02 08:54:18 UTC

[GitHub] [arrow] Crystrix commented on a change in pull request #11789: ARROW-14898: [C++][Compute] Fix crash of out-of-bounds memory accessing in key_hash if a key is smaller than int64

Crystrix commented on a change in pull request #11789:
URL: https://github.com/apache/arrow/pull/11789#discussion_r760879042



##########
File path: cpp/src/arrow/util/ubsan.h
##########
@@ -60,6 +60,14 @@ inline typename std::enable_if<std::is_trivial<T>::value, T>::type SafeLoadAs(
   return ret;
 }
 
+template <typename T>
+inline typename std::enable_if<std::is_trivial<T>::value, T>::type SafeLoadAs(
+    const uint8_t* unaligned, uint32_t length) {
+  typename std::remove_const<T>::type ret;
+  std::memcpy(&ret, unaligned, length);

Review comment:
       The result `ret` is initialized to 0, and comments are added.
   
   




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org