wgtmac opened a new issue, #45126:
URL: https://github.com/apache/arrow/issues/45126

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   > parquet/types.cc:102:17: runtime error: load of misaligned address 
0x7f2f3217e021 for type 'const int32_t' (aka 'const int'), which requires 4 
byte alignment 0x7f2f3217e021: note: pointer points here 7f 00 00 18 00 04 00 
00 00 08 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
   
   The following piece of code has the above undefined behavior when 
UndefinedBehaviorSanitizer is enabled:
   ```
   std::string FormatStatValue(Type::type parquet_type, ::std::string_view val) 
{
     std::stringstream result;
   
     const char* bytes = val.data();
     switch (parquet_type) {
       case Type::BOOLEAN:
         result << reinterpret_cast<const bool*>(bytes)[0];
         break;
       case Type::INT32:
         result << reinterpret_cast<const int32_t*>(bytes)[0];
         break;
       case Type::INT64:
         result << reinterpret_cast<const int64_t*>(bytes)[0];
         break;
       case Type::DOUBLE:
         result << reinterpret_cast<const double*>(bytes)[0];
         break;
       case Type::FLOAT:
         result << reinterpret_cast<const float*>(bytes)[0];
         break;
       case Type::INT96: {
         auto const i32_val = reinterpret_cast<const int32_t*>(bytes);
         result << i32_val[0] << " " << i32_val[1] << " " << i32_val[2];
         break;
       }
       case Type::BYTE_ARRAY: {
         return std::string(val);
       }
       case Type::FIXED_LEN_BYTE_ARRAY: {
         return std::string(val);
       }
       case Type::UNDEFINED:
       default:
         break;
     }
     return result.str();
   }
   ```
   
   ### Component(s)
   
   C++, Parquet


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to