Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Stop Unmarshaling if Offsets Ended #69

Merged
merged 9 commits into from
Aug 16, 2019
Merged

Stop Unmarshaling if Offsets Ended #69

merged 9 commits into from
Aug 16, 2019

Conversation

rauljordan
Copy link
Contributor

This fixes a panic scenario in which we would attempt to marshal and unmarshal data that looks as follows:

type block struct {
	Slot uint64
	Body *blockBody
}

b := &block{
        Slot: 55,
}

We should detect if we have finished reading all variable offset values and stop unmarshaling instead of attempting to continue. A regression test was added to prevent this issue from popping up again.

@rauljordan rauljordan self-assigned this Aug 14, 2019
@rauljordan rauljordan added the bug Something isn't working label Aug 14, 2019
ssz_test.go Outdated Show resolved Hide resolved
Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

LGTM

rauljordan and others added 4 commits August 15, 2019 14:36
Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>
@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

Merging #69 into master will increase coverage by 0.31%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
+ Coverage   75.57%   75.88%   +0.31%     
==========================================
  Files          12       12              
  Lines        1138     1132       -6     
==========================================
- Hits          860      859       -1     
+ Misses        159      155       -4     
+ Partials      119      118       -1
Impacted Files Coverage Δ
types/struct.go 74.54% <100%> (+0.2%) ⬆️
ssz.go 53.62% <0%> (-2.9%) ⬇️
types/determine_size.go 83.19% <0%> (+2.52%) ⬆️
deep_equal.go 64.1% <0%> (+2.56%) ⬆️

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 69ea21b...ec8a44f. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants