forked from cerc-io/plugeth
swarm/api: check for zero length manifest error (#3468)
This commit is contained in:
parent
df096a7771
commit
65f486ff02
@ -62,6 +62,11 @@ func readManifest(manifestReader storage.LazySectionReader, hash storage.Key, dp
|
|||||||
|
|
||||||
// TODO check size for oversized manifests
|
// TODO check size for oversized manifests
|
||||||
size, err := manifestReader.Size(quitC)
|
size, err := manifestReader.Size(quitC)
|
||||||
|
if err != nil { // size == 0
|
||||||
|
// can't determine size means we don't have the root chunk
|
||||||
|
err = fmt.Errorf("Manifest not Found")
|
||||||
|
return
|
||||||
|
}
|
||||||
manifestData := make([]byte, size)
|
manifestData := make([]byte, size)
|
||||||
read, err := manifestReader.Read(manifestData)
|
read, err := manifestReader.Read(manifestData)
|
||||||
if int64(read) < size {
|
if int64(read) < size {
|
||||||
|
Loading…
Reference in New Issue
Block a user