swarm/api: check for zero length manifest error (#3468)

This commit is contained in:
Aron Fischer 2016-12-22 00:32:08 +01:00 committed by Felix Lange
parent df096a7771
commit 65f486ff02

View File

@ -62,6 +62,11 @@ func readManifest(manifestReader storage.LazySectionReader, hash storage.Key, dp
// TODO check size for oversized manifests
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)
read, err := manifestReader.Read(manifestData)
if int64(read) < size {