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

添加安全检查,确保转换后的值在int类型的范围内 #3543

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

lostmaniac
Copy link
Contributor

What this PR does / why we need it?

Add checks

Summary of your change

添加安全检查,确保转换后的值在int类型的范围内

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

Copy link

f2c-ci-robot bot commented Jan 9, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

f2c-ci-robot bot commented Jan 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wanghe-fit2cloud
Copy link
Member

感谢支持!

@ssongliu
Copy link
Collaborator

ssongliu commented Jan 9, 2024

这里加着应该作用不大吧,如果超出范围的话 size, err := strconv.ParseInt(matches[2], 10, 64) 这一行 err 就不为空了,会报错 strconv.ParseInt: parsing xxx: value out of range

@lostmaniac
Copy link
Contributor Author

size, err := strconv.ParseInt(matches[2], 10, 64)
这里检查的是int64,但是下面使用的时候,转换成了int,如果这里超出int的范围就会有问题

@ssongliu
Copy link
Collaborator

ssongliu commented Jan 9, 2024

size, err := strconv.ParseInt(matches[2], 10, 64) 这里检查的是int64,但是下面使用的时候,转换成了int,如果这里超出int的范围就会有问题

👌

@ssongliu
Copy link
Collaborator

ssongliu commented Jan 9, 2024

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm label Jan 9, 2024
@wanghe-fit2cloud wanghe-fit2cloud merged commit 625189c into 1Panel-dev:dev Jan 9, 2024
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants