Jim Apple has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/11118


Change subject: IMPALA-5031: Fix undefined behavior: ptr overflow
......................................................................

IMPALA-5031: Fix undefined behavior: ptr overflow

In expr.add, the standard says:

    When an expression that has integral type is added to or
    subtracted from a pointer, the result has the type of the pointer
    operand. ... If both the pointer operand and the result point to
    elements of the same array object, or one past the last element of
    the array object, the evaluation shall not produce an overflow;
    otherwise, the behavior is undefined.

In the end-to-end tests this is triggered, and the interesting part of
the backtrace is:

include/c++/4.9.2/bits/stl_iterator.h:782:45: runtime error: pointer index 
expression with base 0x000000000000 overflowed to 0xffffffffffffffe8
    #0 __normal_iterator<MemPool::ChunkInfo*, 
vector<MemPool::ChunkInfo>>::operator+(long) const stl_iterator.h:782:45
    #1 MemPool::AcquireData(MemPool*, bool) runtime/mem-pool.cc:190:62
    #2 RowBatch::TransferResourceOwnership(RowBatch*) 
runtime/row-batch.cc:444:26
    #3 RowBatch::AcquireState(RowBatch*) runtime/row-batch.cc:505:8
    #4 HdfsScanNode::GetNextInternal(RuntimeState*, RowBatch*, bool*) 
exec/hdfs-scan-node.cc:105:16
    #5 HdfsScanNode::GetNext(RuntimeState*, RowBatch*, bool*) 
exec/hdfs-scan-node.cc:81:19
    #6 StreamingAggregationNode::GetRowsStreaming(RuntimeState*, RowBatch*) 
exec/streaming-aggregation-node.cc:116:51
    #7 StreamingAggregationNode::GetNext(RuntimeState*, RowBatch*, bool*) 
exec/streaming-aggregation-node.cc:92:41

Change-Id: I3d28a80763adb62572b3dd81ea732d18d957d248
---
M be/src/runtime/mem-pool.cc
1 file changed, 1 insertion(+), 1 deletion(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d28a80763adb62572b3dd81ea732d18d957d248
Gerrit-Change-Number: 11118
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Apple <jbapple-imp...@apache.org>

Reply via email to