You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Sahil Takiar (Code Review)" <ge...@cloudera.org> on 2018/11/02 17:34:52 UTC

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Sahil Takiar has uploaded this change for review. ( http://gerrit.cloudera.org:8080/11844


Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................

IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Fixes an arithmetic overflow in ExchangeNode::GetNextMerging. Prior to
this patch, the code read:

int rows_to_keep = num_rows_skipped_ - offset_;

Where num_rows_skipped_ and offset_ were of type int64_t. The result was
cast to an int which can lead to an overflow if the result exceeds the
value of 2^31. The value of rows_to_keep would be passed into
row-batch.h::CopyRows which would crash due to a DCHECK_LE error.

This crash arises when the value of the OFFSET is a large number, for
example, the query:

select int_col from functional.alltypes order by 1 limit
1 offset 9223372036854775800;

Would crash the Impalad executor for this query.

The fix is to change rows_to_keep to an int64_t to avoid the overflow,
which prevents the DCHECK_LE from failing.

Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
---
M be/src/exec/exchange-node.cc
M be/src/runtime/row-batch.h
M testdata/workloads/functional-query/queries/QueryTest/top-n.test
3 files changed, 10 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/44/11844/1
-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 1
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 2: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 2
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Comment-Date: Mon, 05 Nov 2018 21:33:23 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 2:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/3420/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 2
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Comment-Date: Mon, 05 Nov 2018 17:09:07 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 2: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 2
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Comment-Date: Mon, 05 Nov 2018 17:19:39 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................

IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Fixes an arithmetic overflow in ExchangeNode::GetNextMerging. Prior to
this patch, the code read:

int rows_to_keep = num_rows_skipped_ - offset_;

Where num_rows_skipped_ and offset_ were of type int64_t. The result was
cast to an int which can lead to an overflow if the result exceeds the
value of 2^31. The value of rows_to_keep would be passed into
row-batch.h::CopyRows which would crash due to a DCHECK_LE error.

This crash arises when the value of the OFFSET is a large number, for
example, the query:

select int_col from functional.alltypes order by 1 limit
1 offset 9223372036854775800;

Would crash the Impalad executor for this query.

The fix is to change rows_to_keep to an int64_t to avoid the overflow,
which prevents the DCHECK_LE from failing.

Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Reviewed-on: http://gerrit.cloudera.org:8080/11844
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M be/src/exec/exchange-node.cc
M be/src/runtime/row-batch.h
M testdata/workloads/functional-query/queries/QueryTest/top-n.test
3 files changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Tim Armstrong: Looks good to me, approved
  Impala Public Jenkins: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 3
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 1: Verified-1

Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/3410/


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 1
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Comment-Date: Fri, 02 Nov 2018 21:38:42 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 1:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/3410/ DRY_RUN=true


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 1
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Comment-Date: Fri, 02 Nov 2018 17:35:33 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/11844 )

Change subject: IMPALA-7777: Fix crash due to arithmetic overflows in Exchange Node
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/1263/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/11844
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8bb8064aae6ad25c8a19f6a8869086be7e70400a
Gerrit-Change-Number: 11844
Gerrit-PatchSet: 1
Gerrit-Owner: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Comment-Date: Fri, 02 Nov 2018 18:09:29 +0000
Gerrit-HasComments: No