Fix overflow issues

pull/7913/head
Edd Robinson 2016-10-07 18:29:22 +01:00 committed by Ben Johnson
parent 149b1cef1d
commit ebc92ca04f
No known key found for this signature in database
GPG Key ID: 81741CD251883081
2 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ func (blk *MeasurementBlock) Version() int { return blk.version }
func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementElem, ok bool) { func (blk *MeasurementBlock) Elem(name []byte) (e MeasurementElem, ok bool) {
n := binary.BigEndian.Uint32(blk.hashData[:MeasurementNSize]) n := binary.BigEndian.Uint32(blk.hashData[:MeasurementNSize])
hash := hashKey(name) hash := hashKey(name)
pos := int(hash) % int(n) pos := int(hash % n)
// Track current distance // Track current distance
var d int var d int

View File

@ -63,7 +63,7 @@ func (ts *TagSet) Version() int { return ts.version }
func (ts *TagSet) TagKeyElem(key []byte) TagKeyElem { func (ts *TagSet) TagKeyElem(key []byte) TagKeyElem {
keyN := binary.BigEndian.Uint32(ts.hashData[:TagKeyNSize]) keyN := binary.BigEndian.Uint32(ts.hashData[:TagKeyNSize])
hash := hashKey(key) hash := hashKey(key)
pos := int(hash) % int(keyN) pos := int(hash % keyN)
// Track current distance // Track current distance
var d int var d int
@ -107,7 +107,7 @@ func (ts *TagSet) TagValueElem(key, value []byte) TagValueElem {
hashData := ts.data[kelem.Offset:] hashData := ts.data[kelem.Offset:]
valueN := binary.BigEndian.Uint32(hashData[:TagValueNSize]) valueN := binary.BigEndian.Uint32(hashData[:TagValueNSize])
hash := hashKey(value) hash := hashKey(value)
pos := int(hash) % int(valueN) pos := int(hash % valueN)
// Track current distance // Track current distance
var d int var d int