Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: fix undefined behavior in numeric types cast (cast 1<<64 to uint64) #11968

Merged
merged 9 commits into from Oct 29, 2019

Conversation

H-ZeX
Copy link
Contributor

@H-ZeX H-ZeX commented Sep 1, 2019

Signed-off-by: H-ZeX hzx20112012@gmail.com

What problem does this PR solve?

In go-spec-conversions, there is this paragraph

Conversions between numeric types
...
In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent.

so, float64(1<<64) cast to uint64 is undefined behavor. although in current go compiler, it is (1<<63), which is not same as mysql5.7 does.

Check List

  • integration testing

Code changes

No.

Side effects

No.

Related changes

  • Need to cherry-pick to the release branch

Signed-off-by: H-ZeX <hzx20112012@gmail.com>
Signed-off-by: H-ZeX <hzx20112012@gmail.com>
@codecov
Copy link

codecov bot commented Sep 1, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@0690a5a). Click here to learn what that means.
The diff coverage is 75%.

@@             Coverage Diff             @@
##             master     #11968   +/-   ##
===========================================
  Coverage          ?   80.0309%           
===========================================
  Files             ?        465           
  Lines             ?     107336           
  Branches          ?          0           
===========================================
  Hits              ?      85902           
  Misses            ?      14943           
  Partials          ?       6491

Signed-off-by: H-ZeX <hzx20112012@gmail.com>
Signed-off-by: H-ZeX <hzx20112012@gmail.com>
@H-ZeX
Copy link
Contributor Author

H-ZeX commented Sep 2, 2019

/release

@lonng lonng requested a review from a team as a code owner October 23, 2019 05:55
@ghost ghost requested review from XuHuaiyu and removed request for a team October 23, 2019 05:55
Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lonng lonng requested a review from qw4990 October 23, 2019 05:56
@XuHuaiyu
Copy link
Contributor

/build

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the ci.

@XuHuaiyu
Copy link
Contributor

And do we also need to cherry pick this commit to release-3.1

@H-ZeX
Copy link
Contributor Author

H-ZeX commented Oct 29, 2019

/run-all-tests

@lonng
Copy link
Contributor

lonng commented Oct 29, 2019

@XuHuaiyu PTAL

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XuHuaiyu XuHuaiyu added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. labels Oct 29, 2019
@lonng lonng removed the status/LGT2 Indicates that a PR has LGTM 2. label Oct 29, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 29, 2019

/run-all-tests

@sre-bot sre-bot merged commit 33b726a into pingcap:master Oct 29, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 29, 2019

cherry pick to release-3.0 failed

@sre-bot
Copy link
Contributor

sre-bot commented Oct 29, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Oct 29, 2019

cherry pick to release-3.1 failed

@lonng
Copy link
Contributor

lonng commented Oct 29, 2019

@H-ZeX Please cherry-pick this PR manually.

@H-ZeX H-ZeX deleted the fix_ub_in_numeric_types branch October 29, 2019 09:34
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1 release-3.0. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @lonng PTAL.

@reafans
Copy link
Contributor

reafans commented Apr 9, 2020

/run-cherry-picker

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Apr 9, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Apr 9, 2020

cherry pick to release-2.1 in PR #16238

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Apr 9, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Apr 9, 2020

cherry pick to release-3.0 in PR #16239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants