Skip to content
This repository has been archived by the owner. It is now read-only.

Check struct offset range #112

Merged
merged 6 commits into from Jun 12, 2020
Merged

Check struct offset range #112

merged 6 commits into from Jun 12, 2020

Conversation

prestonvanloon
Copy link
Member

@prestonvanloon prestonvanloon commented Jun 2, 2020

@prestonvanloon prestonvanloon requested a review from rauljordan Jun 2, 2020
types/struct.go Outdated
@@ -240,6 +241,9 @@ func (b *structSSZ) Unmarshal(val reflect.Value, typ reflect.Type, input []byte,
continue
}
nextOff := offsets[offsetIndex+1]
if nextOff > firstOff || nextOff >= uint64(len(input)) {

Choose a reason for hiding this comment

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

It should be perfectly valid for the next offset to be higher than the first offset? Is that first part correct?

types/struct.go Outdated Show resolved Hide resolved
types/struct.go Outdated
@@ -240,6 +241,9 @@ func (b *structSSZ) Unmarshal(val reflect.Value, typ reflect.Type, input []byte,
continue
}
nextOff := offsets[offsetIndex+1]
if nextOff >= uint64(len(input)) {

Choose a reason for hiding this comment

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

If the last element is dynamic and has a 0 size it can be equal to the scope end

types/struct.go Outdated Show resolved Hide resolved
@codecov
Copy link

@codecov codecov bot commented Jun 12, 2020

Codecov Report

Merging #112 into master will decrease coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   75.95%   75.84%   -0.12%     
==========================================
  Files          14       14              
  Lines        1306     1308       +2     
==========================================
  Hits          992      992              
- Misses        189      190       +1     
- Partials      125      126       +1     
Impacted Files Coverage Δ
types/struct.go 77.07% <0.00%> (-0.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6a925e...bc279ab. Read the comment docs.

@rauljordan rauljordan merged commit 6d5c9aa into master Jun 12, 2020
3 of 5 checks passed
@delete-merged-branch delete-merged-branch bot deleted the check-range branch Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants