You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Andrew Lamb (Jira)" <ji...@apache.org> on 2021/03/04 19:44:00 UTC

[jira] [Created] (ARROW-11862) [Rust] String and BinaryArray created from iterators that don't accurately report size can lead to undefined behavior

Andrew Lamb created ARROW-11862:
-----------------------------------

             Summary: [Rust] String and BinaryArray created from iterators that don't accurately report size can lead to undefined behavior
                 Key: ARROW-11862
                 URL: https://issues.apache.org/jira/browse/ARROW-11862
             Project: Apache Arrow
          Issue Type: Bug
            Reporter: Andrew Lamb


As [~jorgecarleitao] says on  https://github.com/apache/arrow/pull/9588#discussion_r584290701

The (Rust) Iterator spec recommends, but does not require, that the iterator reports a correct length. Consumer that lead to undefined behavior from an incorrect size_hint are the causers of said undefined behavior.

The only case where consumers can trust the iterators' length is when the interator implement unsafe trait TrustedLen. Unfortunately, TrustedLen is still in unstable. For that reason, we have been exposing unsafe Buffer::from_trusted_len_iter and the like for those cases.

So the code should be updated to handle the case where the reported `size_hint` turns out to be incorrect



--
This message was sent by Atlassian Jira
(v8.3.4#803005)