andygrove opened a new issue, #2144:
URL: https://github.com/apache/datafusion-comet/issues/2144
### Describe the bug
Claude Code suggested that there is a bug in the following code. We should
investigate and either implement a fix or add documentation explaining why it
is safe.
**Location**: `native/core/src/execution/utils.rs`
```rust
// Check if the pointer alignment is correct.
if array_ptr.align_offset(array_align) != 0 ||
schema_ptr.align_offset(schema_align) != 0 {
unsafe {
std::ptr::write_unaligned(array_ptr, FFI_ArrowArray::new(self));
std::ptr::write_unaligned(schema_ptr,
FFI_ArrowSchema::try_from(self.data_type())?);
}
}
```
**Risk**: Misaligned memory access can cause:
- Performance degradation
- Potential crashes on architectures that require alignment
- Undefined behavior
**Mitigation**: Code properly handles both aligned and unaligned cases
### Steps to reproduce
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]