martin-g commented on code in PR #3433:
URL: https://github.com/apache/avro/pull/3433#discussion_r2454861658
##########
lang/c++/impl/FileStream.cc:
##########
@@ -205,8 +205,15 @@ class BufferCopyInInputStream : public SeekableInputStream
{
void seek(int64_t position) final {
// BufferCopyIn::seek is relative to byteCount_, whereas position is
// absolute.
- in_->seek(position - byteCount_ - available_);
- byteCount_ = position;
+ int64_t offset = position - static_cast<int64_t>(byteCount_) -
static_cast<int64_t>(available_);
+ if (offset < 0) {
+ throw Exception("Negative offset in seek");
+ }
+ in_->seek(static_cast<size_t>(offset));
+ if (position < 0) {
+ throw Exception("Negative position not allowed");
+ }
+ byteCount_ = static_cast<size_t>(position);
Review Comment:
Same here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]