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

2019-08-12 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on IMPALA-8846:
-

Commit f26a32f85542bfdbceb7306a06327f66dc30294a in impala's branch 
refs/heads/master from Daniel Becker
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=f26a32f ]

IMPALA-8846: Undefined behaviour in RleEncoder::Put

To test for overflow, we used 'repeat_count_ <=
std::numeric_limits::max()', but this is always true as
repeat_count_ is an int. This could have lead to undefined behaviour
because we increment repeat_count_ afterwards.

Changed the comparison not to allow equality.

Change-Id: I269443d1f1680e672fde7dd88eab5fcb56c65613
Reviewed-on: http://gerrit.cloudera.org:8080/14042
Reviewed-by: Impala Public Jenkins 
Tested-by: Impala Public Jenkins 


> 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::max(), which is 
> always true (repeat_count_ is an int), then we increment repeat_count which 
> could be std::numeric_limits::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-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org



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

2019-08-08 Thread Daniel Becker (JIRA)


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

Daniel Becker commented on IMPALA-8846:
---

Added some benchmarks.

> 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::max(), which is 
> always true (repeat_count_ is an int), then we increment repeat_count which 
> could be std::numeric_limits::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-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org