This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/main by this push:
new 589d5cab8 Fix Integer Overflow in
`Seekable(Array|File)InputStream::Skip`
589d5cab8 is described below
commit 589d5cab8a27aac94aa4aa2ebc50504d4875b258
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Wed Feb 11 11:21:19 2026 -0800
Fix Integer Overflow in `Seekable(Array|File)InputStream::Skip`
---
c++/src/io/InputStream.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/c++/src/io/InputStream.cc b/c++/src/io/InputStream.cc
index 5e1dc00cc..d4ba61834 100644
--- a/c++/src/io/InputStream.cc
+++ b/c++/src/io/InputStream.cc
@@ -102,7 +102,7 @@ namespace orc {
bool SeekableArrayInputStream::Skip(int count) {
if (count >= 0) {
uint64_t unsignedCount = static_cast<uint64_t>(count);
- if (unsignedCount + position_ <= length_) {
+ if (unsignedCount <= length_ - position_) {
position_ += unsignedCount;
return true;
} else {
@@ -186,7 +186,11 @@ namespace orc {
return false;
}
uint64_t count = static_cast<uint64_t>(signedCount);
- position_ = std::min(position_ + count, length_);
+ if (count > length_ - position_) {
+ position_ = length_;
+ } else {
+ position_ += count;
+ }
pushBack_ = 0;
return position_ < length_;
}