This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/orc.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new a85515e35 Fix Integer Overflow in
`Seekable(Array|File)InputStream::Skip`
a85515e35 is described below
commit a85515e3596b9de2a28c4b5938d748b439e69407
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Wed Feb 18 19:56:35 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 850f799d9..53ac433de 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;
}