don't panic

This commit is contained in:
Thomas Rudin 2019-03-01 06:01:10 +01:00
parent dc3fe0d2d5
commit 2c06fbb851

View File

@ -5,10 +5,11 @@ import (
"bytes"
"compress/zlib"
"errors"
"github.com/sirupsen/logrus"
"io"
"strconv"
"strings"
"github.com/sirupsen/logrus"
)
/*
@ -95,6 +96,11 @@ func parseMetadata(mapblock *MapBlock, data []byte) (int, error) {
valueLength := readU32(metadata, offset)
offset += 4
if len(metadata) <= valueLength+offset {
return 0, errors.New("metadata too short: " + strconv.Itoa(len(metadata)) +
", valuelength: " + strconv.Itoa(int(valueLength)))
}
value := string(metadata[offset : valueLength+offset])
offset += valueLength