You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Daniel Becker (JIRA)" <ji...@apache.org> on 2019/08/08 18:04:00 UTC

[jira] [Updated] (IMPALA-8846) Undefined behaviour in RleEncoder::Put

     [ https://issues.apache.org/jira/browse/IMPALA-8846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Becker updated IMPALA-8846:
----------------------------------
    Attachment: with_check.txt
                original.txt

> Undefined behaviour in RleEncoder::Put
> --------------------------------------
>
>                 Key: IMPALA-8846
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8846
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Daniel Becker
>            Assignee: Daniel Becker
>            Priority: Major
>         Attachments: original.txt, with_check.txt
>
>
> On line [https://github.com/apache/impala/blob/4000da35be69e469500f5f11e0e5fdec119cf5c7/be/src/util/rle-encoding.h#L346,] we test repeat_count_ <= std::numeric_limits<int32_t>::max(), which is always true (repeat_count_ is an int), then we increment repeat_count which could be std::numeric_limits<int32_t>::max() and overflow, which is undefined behaviour for signed integers.
>  
> We should either change <= to < or if we think that this never happens, remove the misleading check.
> If we correct the check, it may lead to some (probably small) performance regression because the compiler could have optimised this out.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org