fragments: if offset is bigger or EQUAL to current fragment size - skip it

This commit is contained in:
Andrey Gusakov 2022-12-21 11:52:49 +03:00
parent 16a8e0b636
commit 15e7aaf9b9
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ void copyRange(uint8_t* destination, FragmentList src, size_t skip, size_t size)
size_t fragmentIndex = 0;
// Find which fragment to start - skip any full fragments smaller than `skip` parameter
while (fragmentIndex < src.count && skip > src.fragments[fragmentIndex].size) {
while (fragmentIndex < src.count && skip >= src.fragments[fragmentIndex].size) {
skip -= src.fragments[fragmentIndex].size;
fragmentIndex++;
}