aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/api
diff options
context:
space:
mode:
authorAron Fischer <github@aron.guru>2016-12-22 07:32:08 +0800
committerFelix Lange <fjl@users.noreply.github.com>2016-12-22 07:32:08 +0800
commit65f486ff020a14e88f6d389935cacebfefe7d003 (patch)
treec0144f0cf7f8b3a4f135eaee447a9ae43dda2d05 /swarm/api
parentdf096a7771f28b9390463004eeb98eb2aebfd90e (diff)
downloaddexon-65f486ff020a14e88f6d389935cacebfefe7d003.tar.gz
dexon-65f486ff020a14e88f6d389935cacebfefe7d003.tar.zst
dexon-65f486ff020a14e88f6d389935cacebfefe7d003.zip
swarm/api: check for zero length manifest error (#3468)
Diffstat (limited to 'swarm/api')
-rw-r--r--swarm/api/manifest.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/swarm/api/manifest.go b/swarm/api/manifest.go
index a289c01f9..d6dc24c48 100644
--- a/swarm/api/manifest.go
+++ b/swarm/api/manifest.go
@@ -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 {