You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/01/04 06:48:12 UTC

[3/3] impala git commit: IMPALA-6355: fix overflow DCHECK in decimal mod

IMPALA-6355: fix overflow DCHECK in decimal mod

The bug is that ConvertToInt128(), by design, only sets 'overflow' if an
overflow occurs. This means that caller needs to initialise the overflow
variable to false, otherwise the value when overflow occurs is
undefined.

Testing:
Reprod the expr-test failure under ASAN, confirmed that it passed after
this fix.

Change-Id: Ifd7ac691155442ba7cba71dd3647208b7c1c0bf9
Reviewed-on: http://gerrit.cloudera.org:8080/8929
Reviewed-by: Bikramjeet Vig <bi...@cloudera.com>
Reviewed-by: Michael Brown <mi...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/4f4912c5
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/4f4912c5
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/4f4912c5

Branch: refs/heads/master
Commit: 4f4912c532532bac6822a91be32d0927d505b861
Parents: 96b976a
Author: Tim Armstrong <ta...@cloudera.com>
Authored: Wed Jan 3 10:56:58 2018 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Thu Jan 4 02:30:48 2018 +0000

----------------------------------------------------------------------
 be/src/runtime/decimal-value.inline.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/4f4912c5/be/src/runtime/decimal-value.inline.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/decimal-value.inline.h b/be/src/runtime/decimal-value.inline.h
index 0f15324..abcdad6 100644
--- a/be/src/runtime/decimal-value.inline.h
+++ b/be/src/runtime/decimal-value.inline.h
@@ -565,7 +565,7 @@ inline DecimalValue<RESULT_T> DecimalValue<T>::Mod(int this_scale,
           y_256 *= DecimalUtil::GetScaleMultiplier<int256_t>(this_scale - other_scale);
         }
         int256_t intermediate_result = x_256 % y_256;
-        bool ovf;
+        bool ovf = false;
         result = ConvertToInt128(intermediate_result,
             DecimalUtil::MAX_UNSCALED_DECIMAL16, &ovf);
         DCHECK(!ovf);