-
-
Save fd0/bebba6cbed61663b170d05438f637f68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/chunker.go b/chunker.go | |
index 593be8f..5632498 100644 | |
--- a/chunker.go | |
+++ b/chunker.go | |
@@ -2,6 +2,7 @@ package chunker | |
import ( | |
"errors" | |
+ "fmt" | |
"io" | |
"sync" | |
) | |
@@ -265,6 +266,10 @@ func (c *Chunker) Next(data []byte) (Chunk, error) { | |
return Chunk{}, err | |
} | |
+ if n < 0 { | |
+ return Chunk{}, fmt.Errorf("ReadFull returned negative number of bytes read: %v", n) | |
+ } | |
+ | |
c.bpos = 0 | |
c.bmax = uint(n) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment