lib/model: Ensure indexes are only received after checking IDs (ref #7649) (#7689)

This commit is contained in:
Simon Frei
2021-06-03 14:58:50 +02:00
committed by GitHub
parent accaf23aa3
commit df48276300
8 changed files with 658 additions and 579 deletions
+7 -1
View File
@@ -885,7 +885,13 @@ func (f *fakeFile) Truncate(size int64) error {
defer f.mut.Unlock()
if f.content != nil {
f.content = f.content[:int(size)]
if int64(cap(f.content)) < size {
c := make([]byte, size)
copy(c[:len(f.content)], f.content)
f.content = c
} else {
f.content = f.content[:int(size)]
}
}
f.rng = nil
f.size = size