In short, when attempting to retrieve small parts of medium sized files (up to 1.5 MB), the relative_pos is incorrectly calculated for index 2+. This results in relative_pos being too low, causing an overlap with prior calls to seek_info when stepping through a file.
To Reproduce
Steps to reproduce the behavior:
Call seek_info with a file smaller than 1.5 MB, using a small length such as 64 KB and increment the pos by 64 KB each time.
Once index 2 is referenced, the relative_pos will return duplicate bytes from the prior call.
Expected behavior
There should be no duplicate bytes returned from prior calls to seek_info().
Screenshots
This is a comparison between 2 files, one using a large length (512 KB) which is successful, vs one which used 128 KB and had duplicate bytes:
Desktop (please complete the followin
g information):
OS: Linux
Smartphone (please complete the following information):
Thank you for contributing to the project! We recommend you check out our "Contributing to the SAFE Network" guide if you haven't already.
Describe the bug
Originally found through integrating sn_client libraries into sn_httpd: https://github.com/maidsafe/safe_network/issues/1621#issue-2245520089
In short, when attempting to retrieve small parts of medium sized files (up to 1.5 MB), the relative_pos is incorrectly calculated for index 2+. This results in relative_pos being too low, causing an overlap with prior calls to
seek_info
when stepping through a file.To Reproduce Steps to reproduce the behavior:
seek_info
with a file smaller than 1.5 MB, using a small length such as 64 KB and increment the pos by 64 KB each time.Expected behavior There should be no duplicate bytes returned from prior calls to seek_info().
Screenshots This is a comparison between 2 files, one using a large length (512 KB) which is successful, vs one which used 128 KB and had duplicate bytes:
Desktop (please complete the followin g information):
Smartphone (please complete the following information):
Additional context