You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/07/26 10:09:58 UTC
[incubator-opendal] branch fix-fuzz-failure-2717 created (now 8d0ca89a9)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a change to branch fix-fuzz-failure-2717
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
at 8d0ca89a9 fix: Seek before the start of file should be invalid
This branch includes the following new commits:
new 8d0ca89a9 fix: Seek before the start of file should be invalid
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-opendal] 01/01: fix: Seek before the start of file should be invalid
Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch fix-fuzz-failure-2717
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit 8d0ca89a9cc1961933196dbcfa162692d646937f
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Wed Jul 26 18:09:27 2023 +0800
fix: Seek before the start of file should be invalid
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
core/src/raw/oio/read/into_read_from_file.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/core/src/raw/oio/read/into_read_from_file.rs b/core/src/raw/oio/read/into_read_from_file.rs
index 52ebbfec2..05bbff2df 100644
--- a/core/src/raw/oio/read/into_read_from_file.rs
+++ b/core/src/raw/oio/read/into_read_from_file.rs
@@ -89,10 +89,16 @@ where
};
match base.checked_add(offset) {
+ // Seek to position like `-123` is invalid.
Some(n) if n < 0 => Poll::Ready(Err(Error::new(
ErrorKind::InvalidInput,
- "invalid seek to a negative or overflowing position",
- ))),
+ "seek to a negative or overflowing position is invalid",
+ ).with_context("position", n.to_string()))),
+ // Seek to position before the start of current file is invalid.
+ Some(n) if n < self.start as i64 => Poll::Ready(Err(Error::new(
+ ErrorKind::InvalidInput,
+ "seek to a position before start of file is invalid",
+ ).with_context("position", n.to_string()).with_context("start", self.start.to_string()))),
Some(n) => {
let cur =
ready!(Pin::new(&mut self.inner).poll_seek(cx, SeekFrom::Start(n as u64)))