Handle unaligned data more robustly

This commit is contained in:
Lou Knauer 2022-03-18 08:37:25 +01:00
parent 5431dd113e
commit 3eba385e97

View File

@ -459,7 +459,11 @@ func (m *MemoryStore) Read(selector Selector, metric string, from, to int64) ([]
return ErrDataDoesNotAlign return ErrDataDoesNotAlign
} }
cdata = cdata[0 : len(cdata)-missingback] newlen := len(cdata) - missingback
if newlen < 1 {
return ErrDataDoesNotAlign
}
cdata = cdata[0:newlen]
if len(cdata) != len(data) { if len(cdata) != len(data) {
return ErrDataDoesNotAlign return ErrDataDoesNotAlign
} }