You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2023/04/11 11:20:02 UTC
[iotdb] branch OffsetBug created (now c2182a4d8a)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch OffsetBug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at c2182a4d8a Fix offset overflow bug
This branch includes the following new commits:
new c2182a4d8a Fix offset overflow bug
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.
[iotdb] 01/01: Fix offset overflow bug
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch OffsetBug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit c2182a4d8aa0c98f0a0b6600429336a1e4f4e0f7
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Tue Apr 11 19:19:46 2023 +0800
Fix offset overflow bug
---
.../iotdb/db/mpp/execution/operator/process/OffsetOperator.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/OffsetOperator.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/OffsetOperator.java
index 37127e82aa..22429b431e 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/OffsetOperator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/operator/process/OffsetOperator.java
@@ -57,7 +57,9 @@ public class OffsetOperator implements ProcessOperator {
return null;
}
if (remainingOffset > 0) {
- int offset = Math.min((int) remainingOffset, block.getPositionCount());
+ // It's safe to narrow long to int here, because block.getPositionCount() will always be less
+ // than Integer.MAX_VALUE
+ int offset = (int) Math.min(remainingOffset, block.getPositionCount());
remainingOffset -= offset;
return block.getRegion(offset, block.getPositionCount() - offset);
} else {