don't panic
This commit is contained in:
parent
dc3fe0d2d5
commit
2c06fbb851
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user