Skip to content

Commit

Permalink
Merge pull request #180 from fzerorubigd/master
Browse files Browse the repository at this point in the history
add a fail input data based on fuzz
  • Loading branch information
lemire authored Apr 21, 2018
2 parents be602e3 + 6fc44f4 commit 77b4f79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ func (b *runContainer16) readFrom(stream io.Reader) (int, error) {
if err != nil {
return 0, err
}
encRun := make([]uint16, 2*numRuns)
by := make([]byte, 4*numRuns)
nr := int(numRuns)
encRun := make([]uint16, 2*nr)
by := make([]byte, 4*nr)
err = binary.Read(stream, binary.LittleEndian, &by)
if err != nil {
return 0, err
Expand All @@ -71,7 +72,6 @@ func (b *runContainer16) readFrom(stream io.Reader) (int, error) {
encRun[i] = binary.LittleEndian.Uint16(by)
by = by[2:]
}
nr := int(numRuns)
for i := 0; i < nr; i++ {
if i > 0 && b.iv[i-1].last() >= encRun[i*2] {
return 0, fmt.Errorf("error: stored runContainer had runs that were not in sorted order!! (b.iv[i-1=%v].last = %v >= encRun[i=%v] = %v)", i-1, b.iv[i-1].last(), i, encRun[i*2])
Expand Down
Binary file added testdata/crashproneinput8.bin
Binary file not shown.

0 comments on commit 77b4f79

Please sign in to comment.