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

fix: index too large may out of range #6258

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Conversation

simlecode
Copy link
Collaborator

@simlecode simlecode commented Jan 10, 2024

关联的Issues (Related Issues)

改动 (Proposed Changes)

mi 的类型是 uint64,当 mi = math.MaxUint64 时,int(mi) = -1,将会使下面代码检查失效,进而导致后续使用时出现数组越界问题( https://github.com/filecoin-project/venus/blob/master/pkg/chainsync/syncer/syncer.go#L751 )。

if int(mi) >= len(msgs.Bls) {
	return fmt.Errorf("index in BlsIncludes (%d) exceeds number of messages (%d)",
		mi, len(msgs.Bls))
}

附注 (Additional Info)

自查清单 (Checklist)

在你认为本 PR 满足被审阅的标准之前,需要确保 / Before you mark the PR ready for review, please make sure that:

  • 符合Venus项目管理规范中关于PR的相关标准 / The PR follows the PR standards set out in the Venus project management guidelines
  • 具有清晰明确的commit message / All commits have a clear commit message.
  • 包含相关的的测试用例或者不需要新增测试用例 / This PR has tests for new functionality or change in behaviour or not need to add new tests.
  • 存在兼容性问题(接口, 配置,数据,灰度),如果存在需要进行文档说明 / This PR has compatibility issues (API, Configuration, Data, GrayRelease), if so, need to be documented.
  • 包含相关的的指南以及文档或者不需要新增文档 / This PR has updated usage guidelines and documentation or not need
  • 通过必要的检查项 / All checks are green

@simlecode simlecode self-assigned this Jan 10, 2024
Copy link
Collaborator

@LinZexiao LinZexiao left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (bc5ddbc) 25% compared to head (00c1abe) 25%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6258   +/-   ##
======================================
  Coverage      25%     25%           
======================================
  Files         631     631           
  Lines       77885   77885           
======================================
+ Hits        20213   20214    +1     
+ Misses      55004   55000    -4     
- Partials     2668    2671    +3     

@simlecode simlecode merged commit d18cba6 into master Jan 10, 2024
3 checks passed
@simlecode simlecode deleted the fix/index-too-large branch January 10, 2024 07:44
simlecode added a commit that referenced this pull request Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants