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


Change subject: IMPALA-5031: prevent signed overflow in decimal
......................................................................

IMPALA-5031: prevent signed overflow in decimal

This removes two signed integer overflows when using the 'conv'
builtin. Signed integer overflow is undefined behavior according to
the C++ standard. The interesting parts of the backtraces are:

    exprs/math-functions-ir.cc:405:13: runtime error: signed integer overflow: 
4738381338321616896 * 36 cannot be represented in type 'long'
    exprs/math-functions-ir.cc:404:24: runtime error: signed integer overflow: 
2 * 4738381338321616896 cannot be represented in type 'long'

    #0 MathFunctions::DecimalInBaseToDecimal(long, signed char, long*) 
exprs/math-functions-ir.cc:404:24
    #1 MathFunctions::ConvInt(impala_udf::FunctionContext*, 
impala_udf::BigIntVal const&, impala_udf::TinyIntVal const&, 
impala_udf::TinyIntVal const&) exprs/math-functions-ir.cc:327:10
    #2 impala_udf::StringVal 
ScalarFnCall::InterpretEval<impala_udf::StringVal>(ScalarExprEvaluator*, 
TupleRow const*) const exprs/scalar-fn-call.cc:485:580
    #3 ScalarFnCall::GetStringVal(ScalarExprEvaluator*, TupleRow const*) const 
exprs/scalar-fn-call.cc:599:44
    #8 UnionNode::MaterializeExprs(vector<ScalarExprEvaluator*> const&, 
TupleRow*, unsigned char*, RowBatch*) exec/union-node-ir.cc:29:14
    #9 UnionNode::GetNextConst(RuntimeState*, RowBatch*) 
exec/union-node.cc:263:5
    #10 UnionNode::GetNext(RuntimeState*, RowBatch*, bool*) 
exec/union-node.cc:296:45

These were triggered in the backend test
ExprTest.MathConversionFunctions.

Change-Id: I0d97dfcf42072750c16e41175765cd9a468a3c39
---
M be/src/exprs/math-functions-ir.cc
1 file changed, 3 insertions(+), 2 deletions(-)



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

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d97dfcf42072750c16e41175765cd9a468a3c39
Gerrit-Change-Number: 11876
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Apple <[email protected]>

Reply via email to