forked from MTSR/mapserver
don't panic
This commit is contained in:
parent
dc3fe0d2d5
commit
2c06fbb851
@ -5,10 +5,11 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"compress/zlib"
|
"compress/zlib"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -95,6 +96,11 @@ func parseMetadata(mapblock *MapBlock, data []byte) (int, error) {
|
|||||||
valueLength := readU32(metadata, offset)
|
valueLength := readU32(metadata, offset)
|
||||||
offset += 4
|
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])
|
value := string(metadata[offset : valueLength+offset])
|
||||||
offset += valueLength
|
offset += valueLength
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user