Skip to content

take_seek doesn't correctly limit std::io::SeekFrom::End #291

@ismell

Description

@ismell

It seems that take_seek doesn't actually remap anything when calling seek. That means that calling seek can put the pointer outside of the defined buffer.

The following assert fails because the seek operation doesn't take into account the start and end constraints.

file.seek(128)?; // Place the pos at 128
let image: &mut TakeSeek<&mut File> = file.take_seek(128); // Make end 256
let offset = image.seek(SeekFrom::End(-64))?; // Should move the cursor to 192 internally, but it moves it to `EoF - 64`.
assert_eq!(offset, 64) <--- Should be `192 - pos`

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions