Jörn Horstmann created ARROW-10914:
--------------------------------------
Summary: [Rust]: SIMD implementation of arithmetic kernels reads
out of bounds
Key: ARROW-10914
URL: https://issues.apache.org/jira/browse/ARROW-10914
Project: Apache Arrow
Issue Type: Bug
Components: Rust
Reporter: Jörn Horstmann
Assignee: Jörn Horstmann
The simd arithmetic kernels use the following pattern repeatedly:
{code}
for i in (0..left.len()).step_by(lanes) { ... }
{code}
If len is not a multiple of the number of lanes, this would read out of bounds
in the last iteration. Currently, all buffers have an additional padding of 64
bytes (equal to the simd width), which masks this problem in most tests. As
soon as we use a slice of an array, it should however be reproducible even with
this padding.
Even without a crash, the issue is detectable with valgrind:
{code}
==31106== Invalid read of size 32
==31106== at 0x1ECEE1:
arrow::compute::kernels::arithmetic::add::hfded8b2c06cf22de (in
/home/joernhorstmann/Source/github/apache/arrow/rust/target/release/deps/arrow-205580f93d58d5a9)
==31106== by 0x2650EF:
arrow::compute::kernels::arithmetic::tests::test_arithmetic_kernel_should_not_rely_on_padding::hacb7c7921dc38e6a
(in
/home/joernhorstmann/Source/github/apache/arrow/rust/target/release/deps/arrow-205580f93d58d5a9)
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)